站台微调

This commit is contained in:
joylink_zhaoerwei 2024-01-12 13:45:39 +08:00
parent ba1ba27719
commit 8f979a4a9c
3 changed files with 119 additions and 130 deletions

View File

@ -49,7 +49,6 @@ export declare class DoorCodeLozenge extends Container {
}
export declare abstract class JlPlatform extends JlGraphic {
static Type: string;
private platformConsts;
rectGraphic: RectGraphic;
constructor(platformConsts: PlatformConstsConfig);
get datas(): IPlatformData;

View File

@ -15,15 +15,14 @@ class RectGraphic extends Container {
this.addChild(this.rect);
}
draw() {
const platformConsts = this.platformConsts;
const rect = this.rect;
const fillColor = this.stateFillColor || platformConsts.noTrainStop;
rect
const fillColor = this.stateFillColor || this.platformConsts.noTrainStop;
this.rect
.clear()
.lineStyle(platformConsts.lineWidth, new Color(fillColor))
.lineStyle(this.platformConsts.lineWidth, new Color(fillColor))
.beginFill(fillColor, 1)
.drawRect(0, 0, platformConsts.width, platformConsts.height).endFill;
rect.pivot = getRectangleCenter(new Rectangle(0, 0, platformConsts.width, platformConsts.height));
.drawRect(0, 0, this.platformConsts.width, this.platformConsts.height)
.endFill;
this.rect.pivot = getRectangleCenter(new Rectangle(0, 0, this.platformConsts.width, this.platformConsts.height));
}
clear() {
this.rect.clear();
@ -44,25 +43,22 @@ class DoorGraphic extends Container {
this.addChild(this.doorCloseGraphic);
}
draw() {
const platformConsts = this.platformConsts;
const doorConsts = platformConsts.doorGraphic;
const doorGraphic = this.doorGraphic;
const doorCloseGraphic = this.doorCloseGraphic;
const doorConsts = this.platformConsts.doorGraphic;
const lineColor = this.stateFillColor || doorConsts.doorGreen;
doorGraphic
this.doorGraphic
.clear()
.lineStyle(platformConsts.lineWidth, new Color(lineColor))
.moveTo(-platformConsts.width / 2 - platformConsts.lineWidth / 2, 0)
.lineStyle(this.platformConsts.lineWidth, new Color(lineColor))
.moveTo(-this.platformConsts.width / 2 - this.platformConsts.lineWidth / 2, 0)
.lineTo(-doorConsts.doorOpenSpacing, 0)
.moveTo(doorConsts.doorOpenSpacing, 0)
.lineTo(platformConsts.width / 2 + platformConsts.lineWidth / 2, 0);
.lineTo(this.platformConsts.width / 2 + this.platformConsts.lineWidth / 2, 0);
//屏蔽门闭合
doorCloseGraphic
this.doorCloseGraphic
.clear()
.lineStyle(platformConsts.lineWidth, new Color(lineColor))
.lineStyle(this.platformConsts.lineWidth, new Color(lineColor))
.moveTo(-doorConsts.doorOpenSpacing, 0)
.lineTo(doorConsts.doorOpenSpacing, 0);
this.position.set(0, -platformConsts.height / 2 - doorConsts.doorPlatformSpacing);
this.position.set(0, -this.platformConsts.height / 2 - doorConsts.doorPlatformSpacing);
}
changePosition() {
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.position));
@ -98,52 +94,46 @@ class CodeGraphic extends Container {
const platformConsts = this.platformConsts;
const codeConsts = this.platformConsts.codeGraphic;
//扣车
const character = this.character;
character.text = 'H';
character.anchor.set(0.5);
character.position.set(-platformConsts.width / 2 -
this.character.text = 'H';
this.character.anchor.set(0.5);
this.character.position.set(-platformConsts.width / 2 -
platformConsts.lineWidth / 2 -
(codeConsts.besideSpacing * 2) / 3, (platformConsts.height * 3) / 4);
character.style.fill = codeConsts.whiteNumbers;
const circle = this.circle;
circle
this.character.style.fill = codeConsts.whiteNumbers;
this.circle
.clear()
.lineStyle(0.5, codeConsts.whiteCircle)
.drawCircle(0, 0, codeConsts.circleRadius);
circle.position.set(-platformConsts.width / 2 -
this.circle.position.set(-platformConsts.width / 2 -
platformConsts.lineWidth / 2 -
(codeConsts.besideSpacing * 4) / 3, (platformConsts.height * 3) / 5);
//区间运行等级状态
const runLevel = this.runLevel;
runLevel.anchor.set(0.5);
runLevel.position.set(platformConsts.width / 2 +
this.runLevel.anchor.set(0.5);
this.runLevel.position.set(platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
3 * codeConsts.besideSpacing, -codeConsts.besideSpacing);
runLevel.style.fill = codeConsts.whiteNumbers;
this.runLevel.style.fill = codeConsts.whiteNumbers;
//区间运行时间
const runTime = this.runTime;
runTime.anchor.set(0.5);
runTime.position.set(platformConsts.width / 2 +
this.runTime.anchor.set(0.5);
this.runTime.position.set(platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
codeConsts.besideSpacing, -codeConsts.besideSpacing);
runTime.style.fill = codeConsts.whiteNumbers;
this.runTime.style.fill = codeConsts.whiteNumbers;
//停站时间
const stopTime = this.stopTime;
stopTime.anchor.set(0.5);
stopTime.position.set(platformConsts.width / 2 +
this.stopTime.anchor.set(0.5);
this.stopTime.position.set(platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
codeConsts.besideSpacing, codeConsts.besideSpacing);
stopTime.style.fill = codeConsts.whiteNumbers;
character.visible = false;
circle.visible = false;
runLevel.visible = false;
stopTime.visible = false;
runTime.visible = false;
this.stopTime.style.fill = codeConsts.whiteNumbers;
this.character.visible = false;
this.circle.visible = false;
this.runLevel.visible = false;
this.stopTime.visible = false;
this.runTime.visible = false;
this.position.set(0, 0);
}
changePosition() {
const platformConsts = this.platformConsts;
const codeConsts = platformConsts.codeGraphic;
const codeConsts = this.platformConsts.codeGraphic;
const psChange = [
this.character,
this.runLevel,
@ -155,9 +145,9 @@ class CodeGraphic extends Container {
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), g.position));
}
});
this.circle.position.set(platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
(codeConsts.besideSpacing * 4) / 3, (-platformConsts.height * 10) / 11);
this.circle.position.set(this.platformConsts.width / 2 +
this.platformConsts.lineWidth / 2 +
(codeConsts.besideSpacing * 4) / 3, (-this.platformConsts.height * 10) / 11);
}
clear() {
this.character.destroy();
@ -174,22 +164,20 @@ class LozengeGraphic extends Container {
this.addChild(this.lozenge);
}
draw() {
const platformConsts = this.platformConsts;
const LozengeConsts = platformConsts.lozengeGraphic;
const lozenge = this.lozenge;
lozenge
const LozengeConsts = this.platformConsts
.lozengeGraphic;
this.lozenge
.clear()
.lineStyle(1, new Color(LozengeConsts.lozengeRed))
.beginFill(LozengeConsts.lozengeRed, 1)
.drawRect(0, 0, platformConsts.height / 4, platformConsts.height / 4)
.drawRect(0, 0, this.platformConsts.height / 4, this.platformConsts.height / 4)
.endFill();
const rect = new Rectangle(0, 0, platformConsts.height / 4, platformConsts.height / 4);
lozenge.pivot = getRectangleCenter(rect);
lozenge.rotation = Math.PI / 4;
lozenge.visible = false;
this.position.set(0, -platformConsts.height / 2 -
this.lozenge.pivot = getRectangleCenter(new Rectangle(0, 0, this.platformConsts.height / 4, this.platformConsts.height / 4));
this.lozenge.rotation = Math.PI / 4;
this.lozenge.visible = false;
this.position.set(0, -this.platformConsts.height / 2 -
LozengeConsts.doorPlatformSpacing -
platformConsts.height / 3);
this.platformConsts.height / 3);
}
changePosition() {
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.position));
@ -229,12 +217,10 @@ class DoorCodeLozenge extends Container {
}
class JlPlatform extends JlGraphic {
static Type = 'Platform';
platformConsts;
rectGraphic;
constructor(platformConsts) {
super(JlPlatform.Type);
this.platformConsts = platformConsts;
this.rectGraphic = new RectGraphic(this.platformConsts);
this.rectGraphic = new RectGraphic(platformConsts);
this.addChild(this.rectGraphic);
}
get datas() {

View File

@ -35,16 +35,20 @@ class RectGraphic extends Container {
this.addChild(this.rect);
}
draw(): void {
const platformConsts = this.platformConsts;
const rect = this.rect;
const fillColor = this.stateFillColor || platformConsts.noTrainStop;
rect
const fillColor = this.stateFillColor || this.platformConsts.noTrainStop;
this.rect
.clear()
.lineStyle(platformConsts.lineWidth, new Color(fillColor))
.lineStyle(this.platformConsts.lineWidth, new Color(fillColor))
.beginFill(fillColor, 1)
.drawRect(0, 0, platformConsts.width, platformConsts.height).endFill;
rect.pivot = getRectangleCenter(
new Rectangle(0, 0, platformConsts.width, platformConsts.height),
.drawRect(0, 0, this.platformConsts.width, this.platformConsts.height)
.endFill;
this.rect.pivot = getRectangleCenter(
new Rectangle(
0,
0,
this.platformConsts.width,
this.platformConsts.height,
),
);
}
clear(): void {
@ -66,27 +70,30 @@ export class DoorGraphic extends Container {
this.addChild(this.doorCloseGraphic);
}
draw(): void {
const platformConsts = this.platformConsts;
const doorConsts = platformConsts.doorGraphic as DoorConstsConfig;
const doorGraphic = this.doorGraphic;
const doorCloseGraphic = this.doorCloseGraphic;
const doorConsts = this.platformConsts.doorGraphic as DoorConstsConfig;
const lineColor = this.stateFillColor || doorConsts.doorGreen;
doorGraphic
this.doorGraphic
.clear()
.lineStyle(platformConsts.lineWidth, new Color(lineColor))
.moveTo(-platformConsts.width / 2 - platformConsts.lineWidth / 2, 0)
.lineStyle(this.platformConsts.lineWidth, new Color(lineColor))
.moveTo(
-this.platformConsts.width / 2 - this.platformConsts.lineWidth / 2,
0,
)
.lineTo(-doorConsts.doorOpenSpacing, 0)
.moveTo(doorConsts.doorOpenSpacing, 0)
.lineTo(platformConsts.width / 2 + platformConsts.lineWidth / 2, 0);
.lineTo(
this.platformConsts.width / 2 + this.platformConsts.lineWidth / 2,
0,
);
//屏蔽门闭合
doorCloseGraphic
this.doorCloseGraphic
.clear()
.lineStyle(platformConsts.lineWidth, new Color(lineColor))
.lineStyle(this.platformConsts.lineWidth, new Color(lineColor))
.moveTo(-doorConsts.doorOpenSpacing, 0)
.lineTo(doorConsts.doorOpenSpacing, 0);
this.position.set(
0,
-platformConsts.height / 2 - doorConsts.doorPlatformSpacing,
-this.platformConsts.height / 2 - doorConsts.doorPlatformSpacing,
);
}
changePosition() {
@ -125,67 +132,61 @@ export class CodeGraphic extends Container {
const platformConsts = this.platformConsts;
const codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig;
//扣车
const character = this.character;
character.text = 'H';
character.anchor.set(0.5);
character.position.set(
this.character.text = 'H';
this.character.anchor.set(0.5);
this.character.position.set(
-platformConsts.width / 2 -
platformConsts.lineWidth / 2 -
(codeConsts.besideSpacing * 2) / 3,
(platformConsts.height * 3) / 4,
);
character.style.fill = codeConsts.whiteNumbers;
const circle = this.circle;
circle
this.character.style.fill = codeConsts.whiteNumbers;
this.circle
.clear()
.lineStyle(0.5, codeConsts.whiteCircle)
.drawCircle(0, 0, codeConsts.circleRadius);
circle.position.set(
this.circle.position.set(
-platformConsts.width / 2 -
platformConsts.lineWidth / 2 -
(codeConsts.besideSpacing * 4) / 3,
(platformConsts.height * 3) / 5,
);
//区间运行等级状态
const runLevel = this.runLevel;
runLevel.anchor.set(0.5);
runLevel.position.set(
this.runLevel.anchor.set(0.5);
this.runLevel.position.set(
platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
3 * codeConsts.besideSpacing,
-codeConsts.besideSpacing,
);
runLevel.style.fill = codeConsts.whiteNumbers;
this.runLevel.style.fill = codeConsts.whiteNumbers;
//区间运行时间
const runTime = this.runTime;
runTime.anchor.set(0.5);
runTime.position.set(
this.runTime.anchor.set(0.5);
this.runTime.position.set(
platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
codeConsts.besideSpacing,
-codeConsts.besideSpacing,
);
runTime.style.fill = codeConsts.whiteNumbers;
this.runTime.style.fill = codeConsts.whiteNumbers;
//停站时间
const stopTime = this.stopTime;
stopTime.anchor.set(0.5);
stopTime.position.set(
this.stopTime.anchor.set(0.5);
this.stopTime.position.set(
platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
codeConsts.besideSpacing,
codeConsts.besideSpacing,
);
stopTime.style.fill = codeConsts.whiteNumbers;
character.visible = false;
circle.visible = false;
runLevel.visible = false;
stopTime.visible = false;
runTime.visible = false;
this.stopTime.style.fill = codeConsts.whiteNumbers;
this.character.visible = false;
this.circle.visible = false;
this.runLevel.visible = false;
this.stopTime.visible = false;
this.runTime.visible = false;
this.position.set(0, 0);
}
changePosition() {
const platformConsts = this.platformConsts;
const codeConsts = platformConsts.codeGraphic as CodeConstsConfig;
const codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig;
const psChange = [
this.character,
this.runLevel,
@ -198,10 +199,10 @@ export class CodeGraphic extends Container {
}
});
this.circle.position.set(
platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
this.platformConsts.width / 2 +
this.platformConsts.lineWidth / 2 +
(codeConsts.besideSpacing * 4) / 3,
(-platformConsts.height * 10) / 11,
(-this.platformConsts.height * 10) / 11,
);
}
clear(): void {
@ -219,29 +220,34 @@ export class LozengeGraphic extends Container {
this.addChild(this.lozenge);
}
draw(): void {
const platformConsts = this.platformConsts;
const LozengeConsts = platformConsts.lozengeGraphic as LozengeConstsConfig;
const lozenge = this.lozenge;
lozenge
const LozengeConsts = this.platformConsts
.lozengeGraphic as LozengeConstsConfig;
this.lozenge
.clear()
.lineStyle(1, new Color(LozengeConsts.lozengeRed))
.beginFill(LozengeConsts.lozengeRed, 1)
.drawRect(0, 0, platformConsts.height / 4, platformConsts.height / 4)
.drawRect(
0,
0,
this.platformConsts.height / 4,
this.platformConsts.height / 4,
)
.endFill();
const rect = new Rectangle(
0,
0,
platformConsts.height / 4,
platformConsts.height / 4,
this.lozenge.pivot = getRectangleCenter(
new Rectangle(
0,
0,
this.platformConsts.height / 4,
this.platformConsts.height / 4,
),
);
lozenge.pivot = getRectangleCenter(rect);
lozenge.rotation = Math.PI / 4;
lozenge.visible = false;
this.lozenge.rotation = Math.PI / 4;
this.lozenge.visible = false;
this.position.set(
0,
-platformConsts.height / 2 -
-this.platformConsts.height / 2 -
LozengeConsts.doorPlatformSpacing -
platformConsts.height / 3,
this.platformConsts.height / 3,
);
}
changePosition() {
@ -286,12 +292,10 @@ export class DoorCodeLozenge extends Container {
export abstract class JlPlatform extends JlGraphic {
static Type = 'Platform';
private platformConsts: PlatformConstsConfig;
rectGraphic: RectGraphic;
constructor(platformConsts: PlatformConstsConfig) {
super(JlPlatform.Type);
this.platformConsts = platformConsts;
this.rectGraphic = new RectGraphic(this.platformConsts);
this.rectGraphic = new RectGraphic(platformConsts);
this.addChild(this.rectGraphic);
}
get datas() {