desc: 调整道岔显示位置

This commit is contained in:
zyy 2019-07-16 16:19:01 +08:00
parent cecc0edf27
commit 896438f51e
4 changed files with 38 additions and 37 deletions

View File

@ -22,9 +22,9 @@ export default class Section extends Group {
this.jmap = jmap; this.jmap = jmap;
this._create(); this._create();
this.on('mousedown', this.mouseclick); // this.on('mousedown', this.mouseclick);
this.on('mouseout', this.mouseleave); // this.on('mouseout', this.mouseleave);
this.on('mouseover', this.mouseenter); // this.on('mouseover', this.mouseenter);
} }
_create() { _create() {

View File

@ -43,8 +43,8 @@ export default class Switch extends Group {
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
var halfWidth = style.sectionWidth / 2; var halfWidth = style.Section.sectionWidth / 2;
var switchWidth = style.sectionWidth + style.sectionBeyondWidth*2 + 0.8; var switchWidth = style.Section.sectionWidth + style.Section.sectionBeyondWidth*2 + 0.8;
var swPadding = style.switchLen; var swPadding = style.switchLen;
var directx = this.triangle.drictx; var directx = this.triangle.drictx;
var directy = this.triangle.dricty; var directy = this.triangle.dricty;
@ -134,8 +134,8 @@ export default class Switch extends Group {
this.relocShelter.position = [-directx * rpx, -directy * 0.2]; this.relocShelter.position = [-directx * rpx, -directy * 0.2];
this.relocShelter.hide(); this.relocShelter.hide();
var sinX = style.sectionWidth / this.triangle.getSinRate(); var sinX = style.Section.sectionWidth / this.triangle.getSinRate();
var switchWidth1 = style.sectionWidth / 2; var switchWidth1 = style.Section.sectionWidth / 2;
var width1 = switchWidth1 * this.triangle.getSinRate(); var width1 = switchWidth1 * this.triangle.getSinRate();
var height1 = switchWidth1 * this.triangle.getCosRate(); var height1 = switchWidth1 * this.triangle.getCosRate();
var width2 = (height1 + switchWidth1) / this.triangle.getTanRate(); var width2 = (height1 + switchWidth1) / this.triangle.getTanRate();
@ -152,7 +152,7 @@ export default class Switch extends Group {
] ]
}, },
style: { style: {
fill: style.sectionSpareColor fill: style.Section.sectionSpareColor
}, },
cursor: 'pointer', cursor: 'pointer',
onmouseover: () => { this.arrowText.show(); }, onmouseover: () => { this.arrowText.show(); },
@ -170,7 +170,7 @@ export default class Switch extends Group {
y2: model.intersection.y y2: model.intersection.y
}, },
style: { style: {
lineWidth: style.sectionWidth + style.sectionBeyondWidth + 1, lineWidth: style.Section.sectionWidth + style.Section.sectionBeyondWidth + 1,
stroke: style.backgroundColor stroke: style.backgroundColor
} }
}); });
@ -235,7 +235,7 @@ export default class Switch extends Group {
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z + 3, z: this.z + 3,
style: { style: {
x: model.namePosition.x + model.intersection.x + this.triangle.drictx * (style.sectionWidth * 3 + style.nameDistance) * this.triangle.getCotRate(), x: model.namePosition.x + model.intersection.x + this.triangle.drictx * (style.Section.sectionWidth * 3 + style.nameDistance) * this.triangle.getCotRate(),
y: model.namePosition.y + model.intersection.y + this.triangle.dricty * (style.nameDistance), y: model.namePosition.y + model.intersection.y + this.triangle.dricty * (style.nameDistance),
text: model.name, text: model.name,
textAlign: this.triangle.drictx === 1 ? 'left' : 'right', textAlign: this.triangle.drictx === 1 ? 'left' : 'right',
@ -423,35 +423,35 @@ export default class Switch extends Group {
switch (state) { switch (state) {
case '00': break; case '00': break;
case '01': /** 空闲*/ case '01': /** 空闲*/
section.setStyle(style, this.style.sectionSpareColor); section.setStyle(style, this.style.Section.sectionSpareColor);
break; break;
case '02': /** 通信车占用*/ case '02': /** 通信车占用*/
section.setStyle(style, this.style.sectionCommunicationOccupiedColor); section.setStyle(style, this.style.Section.sectionCommunicationOccupiedColor);
break; break;
case '03': /** 非通信车占用*/ case '03': /** 非通信车占用*/
section.setStyle(style, this.style.sectionUnCommunicationOccupiedColor); section.setStyle(style, this.style.Section.sectionUnCommunicationOccupiedColor);
break; break;
case '04': /** 进路锁闭*/ case '04': /** 进路锁闭*/
section.setStyle(style, this.style.sectionRouteLockColor); section.setStyle(style, this.style.Section.sectionRouteLockColor);
break; break;
case '05': /** 故障锁闭*/ case '05': /** 故障锁闭*/
section.setStyle(style, this.style.sectionFaultLockColor); section.setStyle(style, this.style.Section.sectionFaultLockColor);
break; break;
case '06': /** 封锁*/ case '06': /** 封锁*/
section.setStyle(style, this.style.sectionBlockColor); section.setStyle(style, this.style.Section.sectionBlockColor);
break; break;
case '07': /** ATC切除*/ case '07': /** ATC切除*/
section.setStyle(style, this.style.sectionAtcExcisionColor); section.setStyle(style, this.style.Section.sectionAtcExcisionColor);
break; break;
case '08': /** ATS切除*/ case '08': /** ATS切除*/
section.setStyle(style, this.style.sectionAtsExcisionColor); section.setStyle(style, this.style.Section.sectionAtsExcisionColor);
section.animateStyle(true) section.animateStyle(true)
.when(1000, { fill: this.style.backgroundColor }) .when(1000, { fill: this.style.backgroundColor })
.when(2000, { fill: this.style.sectionAtsExcisionColor }) .when(2000, { fill: this.style.Section.sectionAtsExcisionColor })
.start(); .start();
break; break;
case '09': /** 进路延续保护 */ case '09': /** 进路延续保护 */
section.setStyle(style, this.style.sectionProtectiveLockColor); section.setStyle(style, this.style.Section.sectionProtectiveLockColor);
break; break;
} }
} }

View File

@ -41,7 +41,7 @@ export default class ELimitLines extends Group {
} }
})); }));
} else { } else {
// const swPadding = model.style.Section.switchLen; // 定位和反位时区段距离岔芯的距离 // const swPadding = model.style.switchLen; // 定位和反位时区段距离岔芯的距离
// var switchWidth = model.style.Section.sectionWidth + model.style.Section.sectionBeyondWidth; // 道岔宽度 // var switchWidth = model.style.Section.sectionWidth + model.style.Section.sectionBeyondWidth; // 道岔宽度
const beg = Object.assign({}, model.points[0]); const beg = Object.assign({}, model.points[0]);
const end = Object.assign({}, model.points[model.points.length - 1]); const end = Object.assign({}, model.points[model.points.length - 1]);

View File

@ -8,12 +8,13 @@ export default class ESeparator extends Group {
super(); super();
this.model = model; this.model = model;
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.style = model.style;
this.z = 6; this.z = 6;
this._create(model); this._create(model);
} }
_create(model) { _create(model) {
if (model && model.style) { if (model && this.style) {
this.partition = new Polyline({ this.partition = new Polyline({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -24,8 +25,8 @@ export default class ESeparator extends Group {
] ]
}, },
style: { style: {
lineWidth: model.style.Section.sectionSeparatorWidth, lineWidth: this.style.Section.sectionSeparatorWidth,
stroke: model.style.Section.sectionSeparatorColor stroke: this.style.Section.sectionSeparatorColor
} }
}); });
@ -35,12 +36,12 @@ export default class ESeparator extends Group {
shape: { shape: {
cx: model.point.x, cx: model.point.x,
cy: model.point.y, cy: model.point.y,
r: model.style.Section.sectionWidth r: this.style.Section.sectionWidth
}, },
style: { style: {
stroke: model.style.Section.sectionInvadeColor, stroke: this.style.Section.sectionInvadeColor,
GBaseLineWidth: 0.5, GBaseLineWidth: 0.5,
fill: model.style.transparentColor fill: this.style.transparentColor
} }
}); });
@ -51,7 +52,7 @@ export default class ESeparator extends Group {
setType(type, show) { setType(type, show) {
const model = this.model; const model = this.model;
if (model && model.style && model.traingle) { if (model && this.style && model.traingle) {
this.remove(this.circle); this.remove(this.circle);
if (type === '00') { if (type === '00') {
this.partition.setShape('points', [ this.partition.setShape('points', [
@ -60,23 +61,23 @@ export default class ESeparator extends Group {
]); ]);
} else if (type === '01') { } else if (type === '01') {
this.partition.setShape('points', [ this.partition.setShape('points', [
[model.point.x, model.point.y - (model.style.Section.sectionWidth)], [model.point.x, model.point.y - (this.style.Section.sectionWidth)],
[model.point.x, model.point.y + (model.style.Section.sectionWidth)] [model.point.x, model.point.y + (this.style.Section.sectionWidth)]
]); ]);
this.add(this.partition); this.add(this.partition);
} else if (type === '02') { } else if (type === '02') {
this.partition.setShape('points', [ this.partition.setShape('points', [
[model.point.x + model.drict * (model.style.Section.sectionWidth), model.point.y - (model.style.Section.sectionWidth * 1.5)], [model.point.x + model.drict * (this.style.Section.sectionWidth), model.point.y - (this.style.Section.sectionWidth * 1.5)],
[model.point.x, model.point.y - (model.style.Section.sectionWidth * 1.5)], [model.point.x, model.point.y - (this.style.Section.sectionWidth * 1.5)],
[model.point.x, model.point.y + (model.style.Section.sectionWidth * 1.5)] [model.point.x, model.point.y + (this.style.Section.sectionWidth * 1.5)]
]); ]);
this.add(this.partition); this.add(this.partition);
} else if (type === '03') { } else if (type === '03') {
this.partition.setShape('points', [ this.partition.setShape('points', [
[model.point.x + model.drict * (model.style.Section.sectionWidth) * 1.2, model.point.y - (model.style.Section.sectionWidth * 1.2)], [model.point.x + model.drict * (this.style.Section.sectionWidth) * 1.2, model.point.y - (this.style.Section.sectionWidth * 1.2)],
[model.point.x, model.point.y - (model.style.Section.sectionWidth * 1.2)], [model.point.x, model.point.y - (this.style.Section.sectionWidth * 1.2)],
[model.point.x, model.point.y + (model.style.Section.sectionWidth * 1.2)], [model.point.x, model.point.y + (this.style.Section.sectionWidth * 1.2)],
[model.point.x + model.drict * (model.style.Section.sectionWidth) * 1.2, model.point.y + (model.style.Section.sectionWidth * 1.2)] [model.point.x + model.drict * (this.style.Section.sectionWidth) * 1.2, model.point.y + (this.style.Section.sectionWidth * 1.2)]
]); ]);
this.add(this.partition); this.add(this.partition);
} else if (type === '04') { } else if (type === '04') {