调整道岔绘制流程

This commit is contained in:
zyy 2020-09-04 10:44:17 +08:00
parent a8bcc13e4c
commit 2b548186c3
2 changed files with 37 additions and 27 deletions

View File

@ -19,7 +19,7 @@ class ETriangle extends Group {
},
style: {
fill: style.Section.line.spareColor,
// fill: 'green',
// fill: 'red',
lineWidth: 0,
stroke: style.Section.line.spareColor
},

View File

@ -12,7 +12,7 @@ import ELockRect from './ELockRect';
import ELockArc from './ELockArc';
import EMouse from './EMouse';
import EHighlight from '../element/EHighlight';
import ERhomboid from './ERhomboid';
// import ERhomboid from './ERhomboid';
import ETriangle from './ETriangle';
import store from '@/store/index_APP_TARGET';
import Vue from 'vue';
@ -91,19 +91,19 @@ export default class Switch extends Group {
onmouseout: () => { this.name.getArrowText().hide(); }
});
const spoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1];
const spoint2 = [spoint1[0] - directx * (width2 + width1) - directx * width3, spoint1[1]];
const spoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1];
const spoint4 = [spoint1[0] + directx * (width2 + width1) - directx * width3, spoint3[1]];
this.rhomboid = new ERhomboid({ // 岔芯 平行四边形 佛山线路专用
zlevel: this.zlevel,
z: this.z,
style: style,
sectionPoints: [spoint1, spoint2, spoint3, spoint4],
cursor: 'pointer',
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
// const spoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1];
// const spoint2 = [spoint1[0] - directx * (width2 + width1) - directx * width3, spoint1[1]];
// const spoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1];
// const spoint4 = [spoint1[0] + directx * (width2 + width1) - directx * width3, spoint3[1]];
// this.rhomboid = new ERhomboid({ // 岔芯 平行四边形 佛山线路专用
// zlevel: this.zlevel,
// z: this.z,
// style: style,
// sectionPoints: [spoint1, spoint2, spoint3, spoint4],
// cursor: 'pointer',
// onmouseover: () => { this.name.getArrowText().show(); },
// onmouseout: () => { this.name.getArrowText().hide(); }
// });
if (this.style.Switch.text.lossRect) { // 道岔失表显示红色矩形框
const lossRect = this.locShelter.getLocal().getBoundingRect();
this.lossShow = new Rect({
@ -125,13 +125,15 @@ export default class Switch extends Group {
this.add(this.lossShow);
this.lossShow.hide();
}
const trapezoidWidth = this.style.Switch.jointImg.trapezoidLength;
// const trapezoidWidth = this.style.Switch.jointImg.trapezoidLength;
const Tspoint1 = [model.intersection.x + directx * width3 + directx * (width2 + width1) - directx * width3, model.intersection.y + directy * switchWidth1];
const Tspoint2 = [Tspoint1[0] - directx * trapezoidWidth, Tspoint1[1]];
const Tspoint3 = [Tspoint1[0] - directx * trapezoidWidth, model.intersection.y - directy * switchWidth1];
const Tspoint2 = [model.intersection.x - directx * width3, Tspoint1[1]];
const Tspoint3 = [model.intersection.x - directx * width3, model.intersection.y - directy * switchWidth1];
// const Tspoint2 = [Tspoint1[0] - directx * trapezoidWidth, Tspoint1[1]];
// const Tspoint3 = [Tspoint1[0] - directx * trapezoidWidth, model.intersection.y - directy * switchWidth1];
const Tspoint4 = [model.intersection.x + directx * width3, Tspoint3[1]];
const Tspoint5 = [Tspoint1[0], Tspoint1[1]];
this.sheltertriangle = new ETriangle({ // 岔芯 直角梯形 D
this.sheltertriangle = new ETriangle({ // 岔芯 直角梯形 C
zlevel: this.zlevel,
z: this.z,
style: style,
@ -177,7 +179,7 @@ export default class Switch extends Group {
this.add(this.locShelter);
this.add(this.relocShelter);
this.add(this.rhomboid);
// this.add(this.rhomboid);
this.add(this.sheltertriangle);
this.add(this.name);
this.add(this.enabledName);
@ -267,7 +269,7 @@ export default class Switch extends Group {
this.name.getNameText().stopAnimation(false);
this.sheltertriangle.hide(); // 直角梯形覆盖图形
this.sheltertriangle.stopAnimation(false);
this.rhomboid.hide();
// this.rhomboid.hide();
this.setHasTextBorder(0);
this.locShelter.hide(); // 定位覆盖图形
this.relocShelter.hide(); // 反位覆盖图形
@ -285,6 +287,9 @@ export default class Switch extends Group {
}
this.relocShelter.hide();
this.sheltertriangle.hide();
// this.sheltertriangle.show(); // 直角梯形覆盖图形
// this.sheltertriangle.setColor('red');
if (this.style.Switch.core.graphShow) { // 佛山线路显示
this.relocShelter.show();
this.sheltertriangle.show();
@ -307,16 +312,20 @@ export default class Switch extends Group {
this.sheltertriangle.show();
this.setSectionState(this.sheltertriangle.getSection(), 'fill', this.model);
} else {
this.rhomboid.show();
this.setSectionState(this.rhomboid.getSection(), 'fill', this.model);
// this.rhomboid.show();
// this.setSectionState(this.rhomboid.getSection(), 'fill', this.model);
this.sheltertriangle.show();
this.setSectionState(this.sheltertriangle.getSection(), 'fill', this.model);
}
if (this.style.Switch.core.graphShow) { // 佛山线路显示
this.sheltertriangle.hide();
// this.sheltertriangle.hide();
this.locShelter.show();
this.locShelter.setColor('#FFFF00');
this.rhomboid.show();
this.rhomboid.setColor('#FFFF00');
// this.rhomboid.show();
// this.rhomboid.setColor('#FFFF00');
this.sheltertriangle.show();
this.sheltertriangle.setColor('#FFFF00');
}
}
@ -543,7 +552,8 @@ export default class Switch extends Group {
model.blockade && this.block(); // 道岔封锁
model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态
model.routeLock && this.setSectionState(this.rhomboid.getSection(), 'fill', this.model);
// model.routeLock && this.setSectionState(this.rhomboid.getSection(), 'fill', this.model);
model.routeLock && this.setSectionState(this.sheltertriangle.getSection(), 'fill', this.model);
// this.interlockingReserved(); // 联锁预留道岔
if (this.style.Switch.sectionAction.flag) { // 哈尔滨线路处理道岔相关区段颜色