代码调整
This commit is contained in:
parent
117d3a3d0b
commit
ba084b23d8
@ -5,6 +5,9 @@ import Group from 'zrender/src/container/Group';
|
||||
import ETextName from '../element/ETextName';
|
||||
// import EHighlight from '../element/EHighlight'; // 名称文字 (共有)
|
||||
import EControl from '../element/EControl';
|
||||
import ESingleControl from './ESingleControl';
|
||||
import EArrow from './EArrow';
|
||||
import { arrow } from '../utils/ShapePoints';
|
||||
|
||||
export default class Station extends Group {
|
||||
constructor(model, style) {
|
||||
@ -16,6 +19,7 @@ export default class Station extends Group {
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.create();
|
||||
this.createControlMode();
|
||||
// this.createTurnBack(); // 创建按图折返
|
||||
this.setState(model);
|
||||
// this.checkIsDrawMap();
|
||||
@ -101,8 +105,126 @@ export default class Station extends Group {
|
||||
}
|
||||
}
|
||||
|
||||
// 创建控制模式
|
||||
createControlMode() {
|
||||
const model = this.model;
|
||||
if (model.visible && model.isCreateControlMode) {
|
||||
// 紧急站控
|
||||
if (this.style.StationControl.lamp.emergencyControlShow) {
|
||||
this.emergencyControl = new ESingleControl({
|
||||
_subType: 'emergency',
|
||||
style: this.style,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
point: {
|
||||
x: model.controlModePoint.x - this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
|
||||
y: model.controlModePoint.y + this.style.StationControl.lamp.offset.y
|
||||
},
|
||||
context: this.style.StationControl.text.emergencyControlText,
|
||||
// model.jjzkContent,
|
||||
pop: false
|
||||
});
|
||||
this.add(this.emergencyControl);
|
||||
}
|
||||
// 中控按钮
|
||||
if (this.style.StationControl.lamp.centerControlShow) {
|
||||
this.centerControl = new ESingleControl({
|
||||
_subType: 'center',
|
||||
style: this.style,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
point: {
|
||||
x: model.controlModePoint.x - this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
|
||||
y: model.controlModePoint.y + this.style.StationControl.lamp.offset.y
|
||||
},
|
||||
context: this.style.StationControl.text.centerControlText,
|
||||
// model.zokContent,
|
||||
pop: false
|
||||
});
|
||||
this.add(this.centerControl);
|
||||
}
|
||||
// 站控按钮
|
||||
if (this.style.StationControl.lamp.substationControlShow) {
|
||||
this.substationControl = new ESingleControl({
|
||||
_subType: 'substation',
|
||||
style: this.style,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
point: {
|
||||
x: model.controlModePoint.x + this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
|
||||
y: model.controlModePoint.y + this.style.StationControl.lamp.offset.y
|
||||
},
|
||||
context: this.style.StationControl.text.substationControlText,
|
||||
// model.zakContent
|
||||
pop: false
|
||||
});
|
||||
this.add(this.substationControl);
|
||||
}
|
||||
// 联锁控
|
||||
if (this.style.StationControl.lamp.interconnectedControlShow) {
|
||||
this.interconnectedControl = new ESingleControl({
|
||||
_subType: 'interconnected',
|
||||
style: this.style,
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
point: {
|
||||
x: model.controlModePoint.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
|
||||
y: model.controlModePoint.y + this.style.StationControl.lamp.offset.y
|
||||
},
|
||||
// context: model.lskContent || '联锁控',
|
||||
context:this.style.StationControl.text.interconnectedControlText || '联锁控',
|
||||
pop: false
|
||||
});
|
||||
this.add(this.interconnectedControl);
|
||||
}
|
||||
// 箭头
|
||||
if (this.style.StationControl.arrow.show) {
|
||||
const point = arrow(this.model.controlModePoint.x, this.model.controlModePoint.y + this.style.StationControl.lamp.radiusR / 2, this.style.StationControl.lamp.distance / 6, this.style.StationControl.lamp.radiusR * 0.8);
|
||||
this.arrowsControl = new EArrow({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
style: this.style,
|
||||
count: this.count,
|
||||
drict: 1,
|
||||
point: point,
|
||||
x: model.controlModePoint.x + this.style.StationControl.lamp.offset.x,
|
||||
y: model.controlModePoint.y + this.style.StationControl.lamp.radiusR / 2 + this.style.StationControl.lamp.offset.y,
|
||||
fill: this.style.StationControl.lamp.grayColor,
|
||||
lineWidth: 1,
|
||||
stroke: this.style.sidelineColor
|
||||
});
|
||||
this.add(this.arrowsControl);
|
||||
}
|
||||
|
||||
}
|
||||
this.setState(model);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
// 设置状态
|
||||
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);
|
||||
// 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);
|
||||
// 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);
|
||||
// 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);
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
getShapeTipPoint() {
|
||||
|
@ -2,8 +2,8 @@
|
||||
* 控制模式
|
||||
*/
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import ESingleControl from './ESingleControl'; // 单个信号灯 (私有)
|
||||
import EArrow from './EArrow';
|
||||
import ESingleControl from '../Station/ESingleControl'; // 单个信号灯 (私有)
|
||||
import EArrow from '../Station/EArrow';
|
||||
import { arrow } from '../utils/ShapePoints';
|
||||
import EMouse from './EMouse';
|
||||
|
||||
|
@ -137,7 +137,11 @@ export default {
|
||||
{ prop: 'kmPost', label: this.$t('map.stationKmPost'), type: 'input' },
|
||||
{ prop: 'kmPostFont', label: this.$t('map.stationKmPostFont'), type: 'font', placeholder: this.$t('tip.kilometerFont') },
|
||||
{ prop: 'kmPostFontColor', label: this.$t('map.stationKmPostFontColor'), type: 'color' },
|
||||
{ prop: 'isCreateControlMode', label: '控制模式:', type: 'checkbox' },
|
||||
{ prop: 'isCreateControlMode', label: '控制模式:', type: 'checkbox', change:true, deviceChange:this.changeControlMode},
|
||||
{ prop: 'controlModePoint', label: this.$t('map.stationControlPosition'), type: 'coordinate', width: '150px', isHidden:!this.editModel.isCreateControlMode, children: [
|
||||
{ prop: 'controlModePoint.x', firstLevel: 'controlModePoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px'},
|
||||
{ prop: 'controlModePoint.y', firstLevel: 'controlModePoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px'}
|
||||
] },
|
||||
{ prop: 'isCreateTurnBack', label: '按图折返:', type: 'checkbox' }
|
||||
]
|
||||
},
|
||||
@ -224,6 +228,20 @@ export default {
|
||||
|
||||
}
|
||||
},
|
||||
changeControlMode(data) {
|
||||
if (data) {
|
||||
this.editModel.controlModePoint = {
|
||||
x:this.editModel.position.x,
|
||||
y:this.editModel.position.y + 30
|
||||
};
|
||||
} else {
|
||||
this.editModel.controlModePoint = {
|
||||
x:0,
|
||||
y:0
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
// 选择管理车站
|
||||
changeChargeStation(data) {
|
||||
if (data.length > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user