岔心状态 绘图代码调整

This commit is contained in:
joylink_cuiweidong 2021-01-15 17:17:17 +08:00
parent 39da2a712d
commit f61df9b1e8
5 changed files with 48 additions and 11 deletions

View File

@ -144,8 +144,13 @@ class SkinCode extends defaultStyle {
display: false // 列车实时位置显示 display: false // 列车实时位置显示
}, },
cross:{ // 岔心 cross:{ // 岔心
speedOffset:{
x:0,
y:50
},
centerSquare:{ centerSquare:{
defaultColor:'#000' defaultColor:'#000',
blockColor:'#00F'
}, },
crossSection:{ crossSection:{
fillColor:'#ff0', fillColor:'#ff0',

View File

@ -141,9 +141,27 @@ export default class ELines extends Group {
} }
}); });
this.crossSpeedText = new Text({
zlevel: this.zlevel,
z: this.z + 8,
style: {
x: result.x + style.Section.cross.speedOffset.x,
y: result.y + style.Section.cross.speedOffset.y,
fontWeight: style.Section.cross.text.fontWeight,
fontSize: style.Section.cross.text.fontSize,
fontFamily: style.Section.cross.text.fontFamily || style.fontFamily,
text: '',
textFill:style.Section.cross.text.fontColor,
textAlign: style.Section.cross.text.textAlign,
textPosition: style.Section.cross.text.textPosition,
textVerticalAlign: style.Section.cross.text.textVerticalAlign
}
});
this.add(this.crossSection); this.add(this.crossSection);
this.add(this.centerSquare); this.add(this.centerSquare);
this.add(this.crossText); this.add(this.crossText);
this.add(this.crossSpeedText);
} }
createLine() { createLine() {
@ -359,6 +377,16 @@ export default class ELines extends Group {
this.crossSection && this.crossSection.setStyle({lineWidth:0, fill:this.model.style.Section.cross.crossSection.fillColor}); this.crossSection && this.crossSection.setStyle({lineWidth:0, fill:this.model.style.Section.cross.crossSection.fillColor});
} }
setCrossBlock() {
this.centerSquare && this.centerSquare.setStyle({fill:this.model.style.Section.cross.centerSquare.blockColor});
}
setCrossUnBlock() {
this.centerSquare && this.centerSquare.setStyle({fill:this.model.style.Section.cross.centerSquare.defaultColor});
}
setCrossSpeedUpperLimit(speedLimit) {
this.crossSpeedText && this.crossSpeedText.setStyle({text:speedLimit});
}
setZleve(lev) { setZleve(lev) {
this.section && this.section.attr('z', lev); this.section && this.section.attr('z', lev);
} }

View File

@ -129,8 +129,6 @@ class EMouse extends Group {
this.add(this.lineBorder); this.add(this.lineBorder);
this.lineBorder.hide(); this.lineBorder.hide();
} }
} else if (this.device.crossSection) {
debugger;
} }
} }

View File

@ -86,12 +86,14 @@ export default class Section extends Group {
/** 设置区段恢复默认状态*/ /** 设置区段恢复默认状态*/
recover() { recover() {
if (this.line) { if (this.line) {
this.line.setCrossUnBlock();
this.line.stopAnimation(true); this.line.stopAnimation(true);
this.sectionBlock && this.sectionBlock.hide(); // 因此特殊区段 this.sectionBlock && this.sectionBlock.hide(); // 因此特殊区段
this.line.setStyle({ this.line.setStyle({
stroke: this.style.Section.line.spareColor, stroke: this.style.Section.line.spareColor,
lineWidth: this.style.Section.line.width lineWidth: this.style.Section.line.width
}); });
this.line.setCrossSpeedUpperLimit('');
} }
this.name && this.name.recover(); this.name && this.name.recover();
this.speedLimit && this.speedLimit.hide(); this.speedLimit && this.speedLimit.hide();
@ -180,6 +182,9 @@ export default class Section extends Group {
lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth
}); });
} }
if (this.style.Section.cross && this.model.type == '04') {
this.line.setCrossBlock();
}
if (this.style.Section.block && this.style.Section.block.blockGlint && this.line) { if (this.style.Section.block && this.style.Section.block.blockGlint && this.line) {
this.line.animateStyle(true, [ this.line.animateStyle(true, [
{ time: 1000, styles: { stroke: this.style.backgroundColor } }, { time: 1000, styles: { stroke: this.style.backgroundColor } },
@ -246,13 +251,15 @@ export default class Section extends Group {
setSpeedUpperLimit(speedUpLimit) { setSpeedUpperLimit(speedUpLimit) {
if (this.style.Section.line.speedLimitColor) { // 宁波三号线 独有 if (this.style.Section.line.speedLimitColor) { // 宁波三号线 独有
this.line.setStyle({stroke: this.style.Section.line.speedLimitColor}); this.line.setStyle({stroke: this.style.Section.line.speedLimitColor});
} else if (this.style.Section.speedLimitName.nameAlone && this.model.type == '03') { // 南京2道岔区段只显示一个名称 } else if (this.style.Section.speedLimitName.nameAlone && this.model.type == '03') { // 南京2道岔区段只显示一个名称
const switchModel = Vue.prototype.$jlmap.mapDevice[this.model.relSwitchCode]; const switchModel = Vue.prototype.$jlmap.mapDevice[this.model.relSwitchCode];
if (switchModel && switchModel.sectionACode == this._code) { if (switchModel && switchModel.sectionACode == this._code) {
this.speedLimit && this.speedLimit.show(); this.speedLimit && this.speedLimit.show();
this.speedLimitName && this.speedLimitName.show(speedUpLimit); this.speedLimitName && this.speedLimitName.show(speedUpLimit);
} }
} else { } else if (this.style.Section.cross && this.model.type == '04') {
this.line.setCrossSpeedUpperLimit(speedUpLimit);
} else {
this.speedLimit && this.speedLimit.show(); this.speedLimit && this.speedLimit.show();
this.speedLimitName && this.speedLimitName.show(speedUpLimit); this.speedLimitName && this.speedLimitName.show(speedUpLimit);
} }

View File

@ -624,7 +624,6 @@ export default {
} }
if (model.parentCode == copySection.code) { // if (model.parentCode == copySection.code) { //
debugger;
let lengthFact = copySection.logicSectionCodeList.filter(code => model.code != code).reduce((pre, code) => { let lengthFact = copySection.logicSectionCodeList.filter(code => model.code != code).reduce((pre, code) => {
const length = this.$store.getters['map/getDeviceByCode'](code).lengthFact; const length = this.$store.getters['map/getDeviceByCode'](code).lengthFact;
return pre + Number(length); return pre + Number(length);