From ed9be45c6a365397a5ca1dce23e91311d7584e82 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Fri, 12 Jan 2024 15:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/packages/Platform/THPlatform.js | 18 ++-- .../packages/Platform/common/JlPlatform.d.ts | 8 +- .../packages/Platform/common/JlPlatform.js | 95 ++++++++++--------- components/packages/Station/GPStation.js | 2 +- components/packages/Station/THStation.js | 2 +- .../packages/Station/common/JlStation.d.ts | 2 +- .../packages/Station/common/JlStation.js | 36 +++---- src/packages/Platform/THPlatform.ts | 18 ++-- src/packages/Platform/common/JlPlatform.ts | 67 ++++++------- src/packages/Station/GPStation.ts | 2 +- src/packages/Station/THStation.ts | 3 +- src/packages/Station/common/JlStation.ts | 41 ++++---- 12 files changed, 143 insertions(+), 151 deletions(-) diff --git a/components/packages/Platform/THPlatform.js b/components/packages/Platform/THPlatform.js index fa9a7b4..1196c7d 100644 --- a/components/packages/Platform/THPlatform.js +++ b/components/packages/Platform/THPlatform.js @@ -19,6 +19,7 @@ class THPlatform extends JlPlatform { return this.getStates(); } doRepaint() { + //站台状态 this.rectGraphic.stateFillColor = THConsts.noTrainStop; if (this.states.trainberth) { this.rectGraphic.stateFillColor = THConsts.trainStop; @@ -26,35 +27,35 @@ class THPlatform extends JlPlatform { if (this.states.upSkipstop || this.states.downSkipstop) { this.rectGraphic.stateFillColor = THConsts.trainJump; } + //门的状态 const station = this.getGraphicApp().queryStore.queryByCodeAndType(this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId, THStation.Type); - const doorGraphic = this.doorGraphic; - doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen; + this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen; if (!!station?.states.ipRtuStusDown) { - doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue; + this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue; } else if (this.states.psdCut) { - doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed; + this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed; } super.draw(); this.doorGraphic.draw(); this.codeGraphic.draw(); - this.lozengeGraphic.draw(); if (this.datas.direction == 'down') { this.doorGraphic.changePosition(); this.codeGraphic.changePosition(); this.lozengeGraphic.changePosition(); } - //门的状态 + //门的显示与隐藏 if (this.datas.hasdoor) { if (this.states.psdOpen) { - doorGraphic.doorCloseGraphic.visible = false; + this.doorGraphic.doorCloseGraphic.visible = false; } else { - doorGraphic.doorCloseGraphic.visible = true; + this.doorGraphic.doorCloseGraphic.visible = true; } } + //紧急停车 if (this.states.emergstop) { this.lozengeGraphic.lozenge.visible = true; } @@ -67,7 +68,6 @@ class THPlatform extends JlPlatform { this.states.upOccHold || this.states.downHold || this.states.downOccHold) { - codeGraphic.character.text = 'H'; codeGraphic.character.visible = true; codeGraphic.circle.visible = true; //上行扣车 diff --git a/components/packages/Platform/common/JlPlatform.d.ts b/components/packages/Platform/common/JlPlatform.d.ts index c984b95..9cfce01 100644 --- a/components/packages/Platform/common/JlPlatform.d.ts +++ b/components/packages/Platform/common/JlPlatform.d.ts @@ -1,5 +1,5 @@ import { JlGraphic, VectorText } from 'jl-graphic'; -import { Container, Graphics, IPointData } from 'pixi.js'; +import { Container, Graphics } from 'pixi.js'; import { IPlatformData, PlatformConstsConfig } from './PlatformConfig'; declare class RectGraphic extends Container { platformConsts: PlatformConstsConfig; @@ -28,6 +28,8 @@ export declare class CodeGraphic extends Container { circle: Graphics; constructor(platformConsts: PlatformConstsConfig); draw(): void; + drawNoChange(): void; + setPosition(): void; changePosition(): void; clear(): void; } @@ -35,7 +37,7 @@ export declare class LozengeGraphic extends Container { platformConsts: PlatformConstsConfig; lozenge: Graphics; constructor(platformConsts: PlatformConstsConfig); - draw(): void; + drawNoChange(): void; changePosition(): void; clear(): void; } @@ -45,7 +47,7 @@ export declare class DoorCodeLozenge extends Container { lozengeGraphic: LozengeGraphic; codeGraphic: CodeGraphic; constructor(platformConsts: PlatformConstsConfig); - draw(hasDoor: boolean, direction: string, platformPos: IPointData): void; + draw(hasDoor: boolean, direction: string): void; } export declare abstract class JlPlatform extends JlGraphic { static Type: string; diff --git a/components/packages/Platform/common/JlPlatform.js b/components/packages/Platform/common/JlPlatform.js index 87e48b4..3d88347 100644 --- a/components/packages/Platform/common/JlPlatform.js +++ b/components/packages/Platform/common/JlPlatform.js @@ -79,52 +79,23 @@ class CodeGraphic extends Container { constructor(platformConsts) { super(); this.platformConsts = platformConsts; - this.addChild(this.character); - this.addChild(this.runLevel); - this.addChild(this.circle); - this.addChild(this.stopTime); - this.addChild(this.runTime); const codeConsts = platformConsts.codeGraphic; - this.character.setVectorFontSize(codeConsts.besideFontSize); - this.runLevel.setVectorFontSize(codeConsts.besideFontSize); - this.stopTime.setVectorFontSize(codeConsts.besideFontSize); - this.runTime.setVectorFontSize(codeConsts.besideFontSize); + const childrenGraphics = [ + this.character, + this.runLevel, + this.runTime, + this.stopTime, + ]; + childrenGraphics.forEach((child) => { + child.setVectorFontSize(codeConsts.besideFontSize); + child.anchor.set(0.5); + child.style.fill = codeConsts.whiteNumbers; + this.addChild(child); + }); + this.addChild(this.circle); + this.drawNoChange(); } draw() { - const platformConsts = this.platformConsts; - const codeConsts = this.platformConsts.codeGraphic; - //扣车 - 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); - this.character.style.fill = codeConsts.whiteNumbers; - this.circle - .clear() - .lineStyle(0.5, codeConsts.whiteCircle) - .drawCircle(0, 0, codeConsts.circleRadius); - this.circle.position.set(-platformConsts.width / 2 - - platformConsts.lineWidth / 2 - - (codeConsts.besideSpacing * 4) / 3, (platformConsts.height * 3) / 5); - //区间运行等级状态 - this.runLevel.anchor.set(0.5); - this.runLevel.position.set(platformConsts.width / 2 + - platformConsts.lineWidth / 2 + - 3 * codeConsts.besideSpacing, -codeConsts.besideSpacing); - this.runLevel.style.fill = codeConsts.whiteNumbers; - //区间运行时间 - this.runTime.anchor.set(0.5); - this.runTime.position.set(platformConsts.width / 2 + - platformConsts.lineWidth / 2 + - codeConsts.besideSpacing, -codeConsts.besideSpacing); - this.runTime.style.fill = codeConsts.whiteNumbers; - //停站时间 - this.stopTime.anchor.set(0.5); - this.stopTime.position.set(platformConsts.width / 2 + - platformConsts.lineWidth / 2 + - codeConsts.besideSpacing, codeConsts.besideSpacing); - this.stopTime.style.fill = codeConsts.whiteNumbers; this.character.visible = false; this.circle.visible = false; this.runLevel.visible = false; @@ -132,6 +103,38 @@ class CodeGraphic extends Container { this.runTime.visible = false; this.position.set(0, 0); } + drawNoChange() { + const codeConsts = this.platformConsts.codeGraphic; + this.circle + .clear() + .lineStyle(0.5, codeConsts.whiteCircle) + .drawCircle(0, 0, codeConsts.circleRadius); + this.character.text = 'H'; + this.setPosition(); + } + setPosition() { + //扣车 + const platformConsts = this.platformConsts; + const codeConsts = this.platformConsts.codeGraphic; + this.character.position.set(-platformConsts.width / 2 - + platformConsts.lineWidth / 2 - + (codeConsts.besideSpacing * 2) / 3, (platformConsts.height * 3) / 4); + this.circle.position.set(-platformConsts.width / 2 - + platformConsts.lineWidth / 2 - + (codeConsts.besideSpacing * 4) / 3, (platformConsts.height * 3) / 5); + //区间运行等级状态 + this.runLevel.position.set(platformConsts.width / 2 + + platformConsts.lineWidth / 2 + + 3 * codeConsts.besideSpacing, -codeConsts.besideSpacing); + //区间运行时间 + this.runTime.position.set(platformConsts.width / 2 + + platformConsts.lineWidth / 2 + + codeConsts.besideSpacing, -codeConsts.besideSpacing); + //停站时间 + this.stopTime.position.set(platformConsts.width / 2 + + platformConsts.lineWidth / 2 + + codeConsts.besideSpacing, codeConsts.besideSpacing); + } changePosition() { const codeConsts = this.platformConsts.codeGraphic; const psChange = [ @@ -162,8 +165,9 @@ class LozengeGraphic extends Container { this.platformConsts = platformConsts; this.lozenge = new Graphics(); this.addChild(this.lozenge); + this.drawNoChange(); } - draw() { + drawNoChange() { const LozengeConsts = this.platformConsts .lozengeGraphic; this.lozenge @@ -201,13 +205,12 @@ class DoorCodeLozenge extends Container { this.codeGraphic = new CodeGraphic(this.platformConsts); this.addChild(this.codeGraphic); } - draw(hasDoor, direction, platformPos) { + draw(hasDoor, direction) { this.doorGraphic.clear(); if (hasDoor) { this.doorGraphic.draw(); } this.codeGraphic.draw(); - this.lozengeGraphic.draw(); if (direction == 'down') { this.doorGraphic.changePosition(); this.codeGraphic.changePosition(); diff --git a/components/packages/Station/GPStation.js b/components/packages/Station/GPStation.js index 5967a67..bee9ce7 100644 --- a/components/packages/Station/GPStation.js +++ b/components/packages/Station/GPStation.js @@ -9,7 +9,7 @@ class GPStation extends JlStation { return this.getStates(); } doRepaint() { - super.doRepaint(); + super.draw(); } } diff --git a/components/packages/Station/THStation.js b/components/packages/Station/THStation.js index 5c36728..0a6f5e9 100644 --- a/components/packages/Station/THStation.js +++ b/components/packages/Station/THStation.js @@ -36,7 +36,7 @@ class THStation extends JlStation { } this.controlGraphic.draw(THConsts); } - super.doRepaint(); + super.draw(); if (this.states.ipRtuStusDown !== this._ipRtuStusDown) { this._ipRtuStusDown = this.states.ipRtuStusDown; //this.handleBlueShow(); diff --git a/components/packages/Station/common/JlStation.d.ts b/components/packages/Station/common/JlStation.d.ts index a03e4a7..a908364 100644 --- a/components/packages/Station/common/JlStation.d.ts +++ b/components/packages/Station/common/JlStation.d.ts @@ -22,5 +22,5 @@ export declare abstract class JlStation extends JlGraphic { constructor(styleType: StyleType); get datas(): IStationData; get code(): string; - doRepaint(): void; + draw(): void; } diff --git a/components/packages/Station/common/JlStation.js b/components/packages/Station/common/JlStation.js index 67ad6d4..028b9dd 100644 --- a/components/packages/Station/common/JlStation.js +++ b/components/packages/Station/common/JlStation.js @@ -83,6 +83,12 @@ class JlStation extends JlGraphic { super(JlStation.Type); this.styleType = styleType; this.stationConsts = stationConstsMap.get(this.styleType); + this.codeGraph.style.fill = this.stationConsts.codeColor; + this.codeGraph.setVectorFontSize(this.stationConsts.codeFontSize); + this.codeGraph.anchor.set(0.5); + this.kilometerGraph.style.fill = this.stationConsts.kilometerCodeColor; + this.kilometerGraph.setVectorFontSize(this.stationConsts.kilometerCodeFontSize); + this.kilometerGraph.anchor.set(0.5); this.addChild(this.codeGraph); this.addChild(this.kilometerGraph); } @@ -92,46 +98,30 @@ class JlStation extends JlGraphic { get code() { return this.datas.code; } - doRepaint() { - const codeGraph = this.codeGraph; - const kilometerGraph = this.kilometerGraph; + draw() { switch (this.styleType) { case StyleType.TH: - codeGraph.text = this.datas?.code + this.codeGraph.text = this.datas?.code ? `${this.datas?.name}(${this.datas?.code})` : `${this.datas?.name}`; break; - case StyleType.GP: - codeGraph.text = this.datas?.code || '车站Station'; + default: + this.codeGraph.text = this.datas?.code || '车站Station'; break; } - codeGraph.style.fill = this.stationConsts.codeColor; - codeGraph.setVectorFontSize(this.stationConsts.codeFontSize); - codeGraph.anchor.set(0.5); const kilometerCode = this.datas.kilometerSystem?.kilometer || 12345678; if (Math.floor(kilometerCode * 1000).toString().length > 3) { const kiloBit = Math.floor(Number(kilometerCode) / 1000000).toString(); - kilometerGraph.text = + this.kilometerGraph.text = 'K' + kiloBit + '+' + (Number(kilometerCode.toString().substring(kiloBit.length)) / 1000).toFixed(3); } else { - kilometerGraph.text = (kilometerCode * 1000).toFixed(3); - } - kilometerGraph.style.fill = this.stationConsts.kilometerCodeColor; - kilometerGraph.setVectorFontSize(this.stationConsts.kilometerCodeFontSize); - kilometerGraph.anchor.set(0.5); - kilometerGraph.position.set(0, this.stationConsts.kilometerCodeOffsetY); - if (this.datas.childTransforms?.length) { - this.datas.childTransforms.forEach((child) => { - if (child.name == 'kilometer') { - const pos = child.transform.position; - kilometerGraph.position.set(pos.x, pos.y); - } - }); + this.kilometerGraph.text = (kilometerCode * 1000).toFixed(3); } + this.kilometerGraph.position.set(0, this.stationConsts.kilometerCodeOffsetY); } } diff --git a/src/packages/Platform/THPlatform.ts b/src/packages/Platform/THPlatform.ts index 3df9aa8..a2fd72a 100644 --- a/src/packages/Platform/THPlatform.ts +++ b/src/packages/Platform/THPlatform.ts @@ -62,6 +62,7 @@ export class THPlatform extends JlPlatform { return this.getStates(); } doRepaint(): void { + //站台状态 this.rectGraphic.stateFillColor = THConsts.noTrainStop; if (this.states.trainberth) { this.rectGraphic.stateFillColor = THConsts.trainStop; @@ -69,6 +70,7 @@ export class THPlatform extends JlPlatform { if (this.states.upSkipstop || this.states.downSkipstop) { this.rectGraphic.stateFillColor = THConsts.trainJump; } + //门的状态 const station = this.getGraphicApp().queryStore.queryByCodeAndType( this.states.rtuId > 9 @@ -76,30 +78,29 @@ export class THPlatform extends JlPlatform { : '0' + this.states.rtuId, THStation.Type, ); - const doorGraphic = this.doorGraphic; - doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen; + this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen; if (!!station?.states.ipRtuStusDown) { - doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue; + this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue; } else if (this.states.psdCut) { - doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed; + this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed; } super.draw(); this.doorGraphic.draw(); this.codeGraphic.draw(); - this.lozengeGraphic.draw(); if (this.datas.direction == 'down') { this.doorGraphic.changePosition(); this.codeGraphic.changePosition(); this.lozengeGraphic.changePosition(); } - //门的状态 + //门的显示与隐藏 if (this.datas.hasdoor) { if (this.states.psdOpen) { - doorGraphic.doorCloseGraphic.visible = false; + this.doorGraphic.doorCloseGraphic.visible = false; } else { - doorGraphic.doorCloseGraphic.visible = true; + this.doorGraphic.doorCloseGraphic.visible = true; } } + //紧急停车 if (this.states.emergstop) { this.lozengeGraphic.lozenge.visible = true; } else { @@ -113,7 +114,6 @@ export class THPlatform extends JlPlatform { this.states.downHold || this.states.downOccHold ) { - codeGraphic.character.text = 'H'; codeGraphic.character.visible = true; codeGraphic.circle.visible = true; //上行扣车 diff --git a/src/packages/Platform/common/JlPlatform.ts b/src/packages/Platform/common/JlPlatform.ts index 1e45299..3366745 100644 --- a/src/packages/Platform/common/JlPlatform.ts +++ b/src/packages/Platform/common/JlPlatform.ts @@ -117,34 +117,49 @@ export class CodeGraphic extends Container { constructor(platformConsts: PlatformConstsConfig) { super(); this.platformConsts = platformConsts; - this.addChild(this.character); - this.addChild(this.runLevel); - this.addChild(this.circle); - this.addChild(this.stopTime); - this.addChild(this.runTime); const codeConsts = platformConsts.codeGraphic as CodeConstsConfig; - this.character.setVectorFontSize(codeConsts.besideFontSize); - this.runLevel.setVectorFontSize(codeConsts.besideFontSize); - this.stopTime.setVectorFontSize(codeConsts.besideFontSize); - this.runTime.setVectorFontSize(codeConsts.besideFontSize); + const childrenGraphics = [ + this.character, + this.runLevel, + this.runTime, + this.stopTime, + ]; + childrenGraphics.forEach((child) => { + child.setVectorFontSize(codeConsts.besideFontSize); + child.anchor.set(0.5); + child.style.fill = codeConsts.whiteNumbers; + this.addChild(child); + }); + this.addChild(this.circle); + this.drawNoChange(); } draw(): void { + 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); + } + drawNoChange() { + const codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig; + this.circle + .clear() + .lineStyle(0.5, codeConsts.whiteCircle) + .drawCircle(0, 0, codeConsts.circleRadius); + this.character.text = 'H'; + this.setPosition(); + } + setPosition() { + //扣车 const platformConsts = this.platformConsts; const codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig; - //扣车 - 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, ); - this.character.style.fill = codeConsts.whiteNumbers; - this.circle - .clear() - .lineStyle(0.5, codeConsts.whiteCircle) - .drawCircle(0, 0, codeConsts.circleRadius); this.circle.position.set( -platformConsts.width / 2 - platformConsts.lineWidth / 2 - @@ -152,38 +167,26 @@ export class CodeGraphic extends Container { (platformConsts.height * 3) / 5, ); //区间运行等级状态 - this.runLevel.anchor.set(0.5); this.runLevel.position.set( platformConsts.width / 2 + platformConsts.lineWidth / 2 + 3 * codeConsts.besideSpacing, -codeConsts.besideSpacing, ); - this.runLevel.style.fill = codeConsts.whiteNumbers; //区间运行时间 - this.runTime.anchor.set(0.5); this.runTime.position.set( platformConsts.width / 2 + platformConsts.lineWidth / 2 + codeConsts.besideSpacing, -codeConsts.besideSpacing, ); - this.runTime.style.fill = codeConsts.whiteNumbers; //停站时间 - this.stopTime.anchor.set(0.5); this.stopTime.position.set( platformConsts.width / 2 + platformConsts.lineWidth / 2 + codeConsts.besideSpacing, codeConsts.besideSpacing, ); - 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 codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig; @@ -218,8 +221,9 @@ export class LozengeGraphic extends Container { this.platformConsts = platformConsts; this.lozenge = new Graphics(); this.addChild(this.lozenge); + this.drawNoChange(); } - draw(): void { + drawNoChange(): void { const LozengeConsts = this.platformConsts .lozengeGraphic as LozengeConstsConfig; this.lozenge @@ -275,13 +279,12 @@ export class DoorCodeLozenge extends Container { this.codeGraphic = new CodeGraphic(this.platformConsts); this.addChild(this.codeGraphic); } - draw(hasDoor: boolean, direction: string, platformPos: IPointData) { + draw(hasDoor: boolean, direction: string) { this.doorGraphic.clear(); if (hasDoor) { this.doorGraphic.draw(); } this.codeGraphic.draw(); - this.lozengeGraphic.draw(); if (direction == 'down') { this.doorGraphic.changePosition(); this.codeGraphic.changePosition(); diff --git a/src/packages/Station/GPStation.ts b/src/packages/Station/GPStation.ts index bc3c0e6..2df447d 100644 --- a/src/packages/Station/GPStation.ts +++ b/src/packages/Station/GPStation.ts @@ -14,6 +14,6 @@ export class GPStation extends JlStation { return this.getStates(); } doRepaint(): void { - super.doRepaint(); + super.draw(); } } diff --git a/src/packages/Station/THStation.ts b/src/packages/Station/THStation.ts index 9d0c88e..404909b 100644 --- a/src/packages/Station/THStation.ts +++ b/src/packages/Station/THStation.ts @@ -49,8 +49,7 @@ export class THStation extends JlStation { } this.controlGraphic.draw(THConsts); } - super.doRepaint(); - + super.draw(); if (this.states.ipRtuStusDown !== this._ipRtuStusDown) { this._ipRtuStusDown = this.states.ipRtuStusDown; //this.handleBlueShow(); diff --git a/src/packages/Station/common/JlStation.ts b/src/packages/Station/common/JlStation.ts index 8adced8..732bdd3 100644 --- a/src/packages/Station/common/JlStation.ts +++ b/src/packages/Station/common/JlStation.ts @@ -105,6 +105,14 @@ export abstract class JlStation extends JlGraphic { this.stationConsts = stationConstsMap.get( this.styleType, ) as StationConstsConfig; + this.codeGraph.style.fill = this.stationConsts.codeColor; + this.codeGraph.setVectorFontSize(this.stationConsts.codeFontSize); + this.codeGraph.anchor.set(0.5); + this.kilometerGraph.style.fill = this.stationConsts.kilometerCodeColor; + this.kilometerGraph.setVectorFontSize( + this.stationConsts.kilometerCodeFontSize, + ); + this.kilometerGraph.anchor.set(0.5); this.addChild(this.codeGraph); this.addChild(this.kilometerGraph); } @@ -116,26 +124,21 @@ export abstract class JlStation extends JlGraphic { return this.datas.code; } - doRepaint(): void { - const codeGraph = this.codeGraph; - const kilometerGraph = this.kilometerGraph; + draw(): void { switch (this.styleType) { case StyleType.TH: - codeGraph.text = this.datas?.code + this.codeGraph.text = this.datas?.code ? `${this.datas?.name}(${this.datas?.code})` : `${this.datas?.name}`; break; - case StyleType.GP: - codeGraph.text = this.datas?.code || '车站Station'; + default: + this.codeGraph.text = this.datas?.code || '车站Station'; break; } - codeGraph.style.fill = this.stationConsts.codeColor; - codeGraph.setVectorFontSize(this.stationConsts.codeFontSize); - codeGraph.anchor.set(0.5); const kilometerCode = this.datas.kilometerSystem?.kilometer || 12345678; if (Math.floor(kilometerCode * 1000).toString().length > 3) { const kiloBit = Math.floor(Number(kilometerCode) / 1000000).toString(); - kilometerGraph.text = + this.kilometerGraph.text = 'K' + kiloBit + '+' + @@ -143,19 +146,11 @@ export abstract class JlStation extends JlGraphic { Number(kilometerCode.toString().substring(kiloBit.length)) / 1000 ).toFixed(3); } else { - kilometerGraph.text = (kilometerCode * 1000).toFixed(3); - } - kilometerGraph.style.fill = this.stationConsts.kilometerCodeColor; - kilometerGraph.setVectorFontSize(this.stationConsts.kilometerCodeFontSize); - kilometerGraph.anchor.set(0.5); - kilometerGraph.position.set(0, this.stationConsts.kilometerCodeOffsetY); - if (this.datas.childTransforms?.length) { - this.datas.childTransforms.forEach((child) => { - if (child.name == 'kilometer') { - const pos = child.transform.position; - kilometerGraph.position.set(pos.x, pos.y); - } - }); + this.kilometerGraph.text = (kilometerCode * 1000).toFixed(3); } + this.kilometerGraph.position.set( + 0, + this.stationConsts.kilometerCodeOffsetY, + ); } }