修改道岔代码

This commit is contained in:
zyy 2019-07-22 15:32:25 +08:00
parent e9b66e1cea
commit dd32206ef0
3 changed files with 13 additions and 12 deletions

View File

@ -17,13 +17,13 @@ class ESwCore extends Group {
z: model.z,
silent: true,
shape: {
x1: model.intersectionX - model.coverLength,
x1: model.intersectionX - (model.coverLength * model.triangle.drictx),
y1: model.intersectionY,
x2: model.intersectionX + model.coverLength,
x2: model.intersectionX + model.triangle.drictx * model.triangle.getCotRate() * model.coverLength,
y2: model.intersectionY
},
style: {
lineWidth: model.switchWidth,
lineWidth: model.lineWidth,
stroke: style.backgroundColor
}
});
@ -36,10 +36,10 @@ class ESwCore extends Group {
x1: model.intersectionX,
y1: model.intersectionY,
x2: model.intersectionX + model.triangle.drictx * model.triangle.getCotRate() * model.coverLength,
y2: model.intersectiony + model.triangle.dricty * model.coverLength
y2: model.intersectionY + model.triangle.dricty * model.coverLength
},
style: {
lineWidth: model.switchWidth,
lineWidth: model.lineWidth,
stroke: style.backgroundColor
}
});

View File

@ -15,7 +15,7 @@ class ESwName extends Group {
this.nameText = new Text({
zlevel: model.zlevel,
z: model.z + 3,
z: model.z + 6,
style: {
x: model.nameTextX,
y: model.nameTextY,
@ -36,7 +36,7 @@ class ESwName extends Group {
this.textRect = new Rect({
zlevel: model.zlevel,
z: model.z + 2,
z: model.z + 5,
silent: true,
shape: {
x: rect.x,

View File

@ -55,7 +55,7 @@ export default class Switch extends Group {
const point2 = [point1[0] + directx * switchWidth / this.triangle.getSinRate(), point1[1]];
const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding];
const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth), point3[1] - direct * this.triangle.getCos(switchWidth)];
this.locShelter = new Polygon({
this.locShelter = new Polygon({ // 定位道岔
zlevel: this.zlevel,
z: this.z,
shape: {
@ -79,7 +79,7 @@ export default class Switch extends Group {
const rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.getCotRate()), rpoint1[1]];
const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth];
const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)];
this.relocShelter = new Polygon({
this.relocShelter = new Polygon({ // 反位道岔
zlevel: this.zlevel,
z: this.z,
shape: {
@ -108,8 +108,9 @@ export default class Switch extends Group {
const switchPoint2 = [switchPoint1[0] - directx * (width2 + width1) - directx * width3, switchPoint1[1]];
const switchPoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1];
const switchPoint4 = [switchPoint1[0] + directx * (width2 + width1) - directx * width3, switchPoint3[1]];
this.reserveSection = new Polygon({
this.reserveSection = new Polygon({ // 道岔中心
zlevel: this.zlevel,
z: this.z,
shape: {
points: [
switchPoint1, switchPoint2, switchPoint3, switchPoint4
@ -124,7 +125,7 @@ export default class Switch extends Group {
});
this.reserveSection.hide();
this.releaseBackground = new Line({
this.releaseBackground = new Line({ // 区段上遮盖段
zlevel: this.zlevel,
z: this.z,
shape: {
@ -157,7 +158,7 @@ export default class Switch extends Group {
triangle: this.triangle
});
this.add(this.swCore);
this.add(this.swCore); // 岔芯link
this.add(this.locShelter);
this.add(this.relocShelter);
this.add(this.reserveSection);