调整集中站指示灯状态,绘图显示
This commit is contained in:
parent
7ff7deae48
commit
3510548b7b
@ -321,7 +321,7 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
StationControl: {
|
||||
text: {
|
||||
distance: 2, // 灯和文字之间的距离
|
||||
distance: 12, // 灯和文字之间的距离
|
||||
fontSize: 12, // 字体大小
|
||||
fontFormat: 'consolas', // 字体格式
|
||||
fontColor: '#ffffff', // 字体颜色
|
||||
@ -339,7 +339,7 @@ class SkinCode extends defaultStyle {
|
||||
lamp: {
|
||||
count: 4, // 控制模式的个数
|
||||
offset: { x: 20, y: 0 }, // 偏移量
|
||||
radiusR: 4, // 控制模式灯的半径
|
||||
radiusR: 5, // 控制模式灯的半径
|
||||
distance: 46, // 控制模式之间灯之间的距离
|
||||
grayColor: '#C0C0C0', // 控制模式灰色
|
||||
greenColor: 'green', // 控制模式绿色
|
||||
@ -349,7 +349,9 @@ class SkinCode extends defaultStyle {
|
||||
centerControlShow: true, // 中控显示
|
||||
substationControlShow: true, // 站控按钮显示
|
||||
interconnectedControlShow: false, // 联锁控显示
|
||||
centerControlButtonShow: true // 中控显示
|
||||
centerControlButtonShow: true, // 中控显示
|
||||
stroke: '#FFFFFF', // 框的颜色
|
||||
fill: 'rgba(0,0,0,0)', // 填充色
|
||||
},
|
||||
arrow: {
|
||||
show: false // 控制模式箭头显隐
|
||||
|
@ -4,7 +4,6 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Arc from 'zrender/src/graphic/shape/Arc';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
import { createBoundingRect } from '../../utils/parser';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import EMouse from './EMouse';
|
||||
|
||||
|
@ -36,7 +36,7 @@ export default class ESingleControl extends Group {
|
||||
r: model.style.Station.StationControl.lamp.radiusR
|
||||
},
|
||||
style: {
|
||||
lineWidth: 0.5,
|
||||
lineWidth: 0,
|
||||
fill: 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);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import EMouse from './EMouse';
|
||||
import ESingleControl from './ESingleControl';
|
||||
import EArrow from './EArrow';
|
||||
import { arrow } from '../utils/ShapePoints';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import BoundingRect from 'zrender/src/core/BoundingRect';
|
||||
|
||||
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,
|
||||
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
|
||||
},
|
||||
// context: model.lskContent || '联锁控',
|
||||
context: this.style.Station.StationControl.text.interconnectedControlText || '联锁控',
|
||||
pop: false
|
||||
});
|
||||
@ -247,6 +247,19 @@ export default class Station extends Group {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,75 +26,75 @@ export default class StationControl extends Group {
|
||||
create() {
|
||||
const model = this.model;
|
||||
// 紧急站控
|
||||
if (this.style.StationControl.lamp.emergencyControlShow) {
|
||||
if (this.style.Station.StationControl.lamp.emergencyControlShow) {
|
||||
this.emergencyControl = new ESingleControl({
|
||||
_subType: 'emergency',
|
||||
style: this.style,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
point: {
|
||||
x: model.position.x - this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
|
||||
y: model.position.y + this.style.StationControl.lamp.offset.y
|
||||
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.Station.StationControl.lamp.offset.y
|
||||
},
|
||||
context: this.style.StationControl.text.emergencyControlText,
|
||||
context: this.style.Station.StationControl.text.emergencyControlText,
|
||||
// model.jjzkContent,
|
||||
pop: false
|
||||
});
|
||||
this.add(this.emergencyControl);
|
||||
}
|
||||
// 中控按钮
|
||||
if (this.style.StationControl.lamp.centerControlShow) {
|
||||
if (this.style.Station.StationControl.lamp.centerControlShow) {
|
||||
this.centerControl = new ESingleControl({
|
||||
_subType: 'center',
|
||||
style: this.style,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
point: {
|
||||
x: model.position.x - this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
|
||||
y: model.position.y + this.style.StationControl.lamp.offset.y
|
||||
x: model.position.x - this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.lamp.offset.x,
|
||||
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,
|
||||
pop: false
|
||||
});
|
||||
this.add(this.centerControl);
|
||||
}
|
||||
// 站控按钮
|
||||
if (this.style.StationControl.lamp.substationControlShow) {
|
||||
if (this.style.Station.StationControl.lamp.substationControlShow) {
|
||||
this.substationControl = new ESingleControl({
|
||||
_subType: 'substation',
|
||||
style: this.style,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
point: {
|
||||
x: model.position.x + this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
|
||||
y: model.position.y + this.style.StationControl.lamp.offset.y
|
||||
x: model.position.x + this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.lamp.offset.x,
|
||||
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
|
||||
pop: false
|
||||
});
|
||||
this.add(this.substationControl);
|
||||
}
|
||||
// 联锁控
|
||||
if (this.style.StationControl.lamp.interconnectedControlShow) {
|
||||
if (this.style.Station.StationControl.lamp.interconnectedControlShow) {
|
||||
this.interconnectedControl = new ESingleControl({
|
||||
_subType: 'interconnected',
|
||||
style: this.style,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
point: {
|
||||
x: model.position.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
|
||||
y: model.position.y + this.style.StationControl.lamp.offset.y
|
||||
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.Station.StationControl.lamp.offset.y
|
||||
},
|
||||
context: this.style.StationControl.text.interconnectedControlText || '联锁控',
|
||||
context: this.style.Station.StationControl.text.interconnectedControlText || '联锁控',
|
||||
pop: false
|
||||
});
|
||||
this.add(this.interconnectedControl);
|
||||
}
|
||||
// 箭头
|
||||
if (this.style.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);
|
||||
if (this.style.Station.StationControl.arrow.show) {
|
||||
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({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
@ -102,9 +102,9 @@ export default class StationControl extends Group {
|
||||
count: this.count,
|
||||
drict: 1,
|
||||
point: point,
|
||||
x: model.position.x + this.style.StationControl.lamp.offset.x,
|
||||
y: model.position.y + this.style.StationControl.lamp.radiusR / 2 + this.style.StationControl.lamp.offset.y,
|
||||
fill: this.style.StationControl.lamp.grayColor,
|
||||
x: model.position.x + this.style.Station.StationControl.lamp.offset.x,
|
||||
y: model.position.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
|
||||
fill: this.style.Station.StationControl.lamp.grayColor,
|
||||
lineWidth: 1,
|
||||
stroke: this.style.sidelineColor
|
||||
});
|
||||
@ -116,28 +116,40 @@ export default class StationControl extends Group {
|
||||
setState(model) {
|
||||
// switch (model.status) {
|
||||
// case '00': // 无状态
|
||||
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
|
||||
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
|
||||
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
|
||||
// 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.grayColor);
|
||||
// break;
|
||||
// case '01': // 中控
|
||||
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
|
||||
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
|
||||
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.greenColor);
|
||||
// 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);
|
||||
// break;
|
||||
// case '02': // 站控
|
||||
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
|
||||
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.yellowColor);
|
||||
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
|
||||
// this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
// this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.yellowColor);
|
||||
// this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
// break;
|
||||
// case '03': // 紧急站控
|
||||
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.redColor);
|
||||
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
|
||||
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
|
||||
// this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.redColor);
|
||||
// this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
// this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
// 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) {
|
||||
for (var i = 0; i < this.childCount(); i++) {
|
||||
|
@ -221,7 +221,6 @@ export default {
|
||||
operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL;
|
||||
operate.operation = OperationEvent.StationControl.requestStationControl.menu.operation;
|
||||
}
|
||||
console.log(operate);
|
||||
|
||||
this.loading = true;
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
@ -229,10 +228,10 @@ export default {
|
||||
if (valid) {
|
||||
this.doClose();
|
||||
}
|
||||
}).catch(() => {
|
||||
}).catch((error) => {
|
||||
this.loading = false;
|
||||
this.doClose();
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
this.$refs.noticeInfo.doShow(operate, error.message);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -116,7 +116,6 @@ export default {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
operation: OperationEvent.StationControl.requestCentralControl.menu.operation,
|
||||
// cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL,
|
||||
param: {
|
||||
stationControlCode: this.selected.code
|
||||
}
|
||||
@ -133,7 +132,6 @@ export default {
|
||||
start: true,
|
||||
code: this.selected.code,
|
||||
operation: OperationEvent.StationControl.requestStationControl.menu.operation,
|
||||
// cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL,
|
||||
param: {
|
||||
stationControlCode: this.selected.code
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user