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._create();
this.on('mousedown', this.mouseclick);
this.on('mouseout', this.mouseleave);
this.on('mouseover', this.mouseenter);
// this.on('mousedown', this.mouseclick);
// this.on('mouseout', this.mouseleave);
// this.on('mouseover', this.mouseenter);
}
_create() {

View File

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

View File

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

View File

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