From b5d778ea24a238bb58323521fb56854878b3bf40 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Tue, 16 Jan 2024 09:43:31 +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/Turnout/GPTurnout.d.ts | 4 +-- components/packages/Turnout/GPTurnout.js | 9 ++++-- components/packages/Turnout/Turnout.d.ts | 33 ---------------------- components/packages/Turnout/Turnout.js | 30 -------------------- src/packages/Turnout/GPTurnout.ts | 7 +++-- 5 files changed, 13 insertions(+), 70 deletions(-) delete mode 100644 components/packages/Turnout/Turnout.d.ts delete mode 100644 components/packages/Turnout/Turnout.js diff --git a/components/packages/Turnout/GPTurnout.d.ts b/components/packages/Turnout/GPTurnout.d.ts index 859708b..c9c186c 100644 --- a/components/packages/Turnout/GPTurnout.d.ts +++ b/components/packages/Turnout/GPTurnout.d.ts @@ -1,5 +1,5 @@ import { JlTurnout } from './common/JlTurnout'; -export declare class Turnout extends JlTurnout { - static Type: string; +export declare class GPTurnout extends JlTurnout { + constructor(); doRepaint(): void; } diff --git a/components/packages/Turnout/GPTurnout.js b/components/packages/Turnout/GPTurnout.js index 71801eb..7717a37 100644 --- a/components/packages/Turnout/GPTurnout.js +++ b/components/packages/Turnout/GPTurnout.js @@ -1,10 +1,13 @@ import { JlTurnout } from './common/JlTurnout.js'; +import { GPConsts } from './common/TurnoutConfig.js'; -class Turnout extends JlTurnout { - static Type = 'Turnout'; +class GPTurnout extends JlTurnout { + constructor() { + super(GPConsts); + } doRepaint() { super.draw(); } } -export { Turnout }; +export { GPTurnout }; diff --git a/components/packages/Turnout/Turnout.d.ts b/components/packages/Turnout/Turnout.d.ts deleted file mode 100644 index 8785448..0000000 --- a/components/packages/Turnout/Turnout.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { DevicePort, IRelatedRef, KilometerSystem } from 'common/common'; -import { GraphicData, JlGraphic } from 'jl-graphic'; -import { IPointData } from 'pixi.js'; -export declare enum SwitchMachineType { - Unknown = 0, - ZDJ9_Single = 1, - ZDJ9_Double = 2 -} -export interface ITurnoutData extends GraphicData { - code: string; - pointA: IPointData[]; - pointB: IPointData[]; - pointC: IPointData[]; - paRef?: IRelatedRef; - pbRef?: IRelatedRef; - pcRef?: IRelatedRef; - kilometerSystem: KilometerSystem; - paTrackSectionId?: number; - pbTrackSectionId?: number; - pcTrackSectionId?: number; - switchMachineType?: SwitchMachineType; - centralizedStations?: number[]; - clone(): ITurnoutData; - copyFrom(data: ITurnoutData): void; - eq(other: ITurnoutData): boolean; -} -export declare class Turnout extends JlGraphic { - static Type: string; - doRepaint(): void; - get datas(): ITurnoutData; - getGraphicOfPort(port: DevicePort): JlGraphic[]; - getPortPoints(): IPointData[][]; -} diff --git a/components/packages/Turnout/Turnout.js b/components/packages/Turnout/Turnout.js deleted file mode 100644 index ce460b7..0000000 --- a/components/packages/Turnout/Turnout.js +++ /dev/null @@ -1,30 +0,0 @@ -import { JlGraphic } from 'jl-graphic'; - -var SwitchMachineType; -(function (SwitchMachineType) { - SwitchMachineType[SwitchMachineType["Unknown"] = 0] = "Unknown"; - SwitchMachineType[SwitchMachineType["ZDJ9_Single"] = 1] = "ZDJ9_Single"; - SwitchMachineType[SwitchMachineType["ZDJ9_Double"] = 2] = "ZDJ9_Double"; -})(SwitchMachineType || (SwitchMachineType = {})); -class Turnout extends JlGraphic { - static Type = 'Turnout'; - doRepaint() { - console.log(111); - } - get datas() { - return this.getDatas(); - } - getGraphicOfPort(port) { - return this.relationManage - .getRelationsOfGraphic(this) - .filter((relation) => relation.getRelationParam(this).getParam() === port) - .map((relation) => { - return relation.getOtherGraphic(this); - }); - } - getPortPoints() { - return [this.datas.pointA, this.datas.pointB, this.datas.pointC]; - } -} - -export { SwitchMachineType, Turnout }; diff --git a/src/packages/Turnout/GPTurnout.ts b/src/packages/Turnout/GPTurnout.ts index dc3f290..60ca061 100644 --- a/src/packages/Turnout/GPTurnout.ts +++ b/src/packages/Turnout/GPTurnout.ts @@ -1,7 +1,10 @@ import { JlTurnout } from './common/JlTurnout'; +import { GPConsts } from './common/TurnoutConfig'; -export class Turnout extends JlTurnout { - static Type = 'Turnout'; +export class GPTurnout extends JlTurnout { + constructor() { + super(GPConsts); + } doRepaint(): void { super.draw(); }