打包配置修改

This commit is contained in:
Yuan 2024-01-02 14:36:10 +08:00
parent f116feb020
commit 1a5e3bda87
52 changed files with 3245 additions and 560 deletions

24
components/EsbButton/ThEsbButton.d.ts vendored Normal file
View File

@ -0,0 +1,24 @@
import { Graphics } from 'pixi.js';
import { GraphicData, GraphicState, JlGraphic, VectorText } from 'jl-graphic';
export interface IEsbButtonData extends GraphicData {
get code(): string;
set code(v: string);
get flip(): boolean;
set flip(v: boolean);
}
export interface IEsbButtonState extends GraphicState {
id: number;
get down(): boolean;
set down(v: boolean);
}
export declare class EsbButton extends JlGraphic {
static Type: string;
codeGraph: VectorText;
circleBody: Graphics;
rectBody: Graphics;
lineBody: Graphics;
constructor();
get datas(): IEsbButtonData;
get state(): IEsbButtonState;
doRepaint(): void;
}

View File

@ -0,0 +1,79 @@
import { Graphics } from 'pixi.js';
import { JlGraphic, VectorText } from 'jl-graphic';
const esbButtonConsts = {
codeFontSize: 12,
codeColor: 0xffffff,
bodyLineColor: 0xffffff,
bodyLineWidth: 4,
bodyRectLineColor: 0xffffff,
bodyRectLineWidth: 2,
bodyRectWidth: 20,
bodyRectHeight: 20,
bodyCircleRadius: 5,
bodyCircleColor: 0xffffff,
bodyColor: 0x000000,
pressedColor: 0xff0000,
};
class EsbButton extends JlGraphic {
static Type = 'esbButton';
codeGraph = new VectorText('');
circleBody = new Graphics();
rectBody = new Graphics();
lineBody = new Graphics();
constructor() {
super(EsbButton.Type);
this.addChild(this.codeGraph);
this.addChild(this.rectBody);
this.addChild(this.lineBody);
this.addChild(this.circleBody);
this.codeGraph.name = 'esb_code';
}
get datas() {
return this.getDatas();
}
get state() {
return this.getStates();
}
doRepaint() {
const codeGraph = this.codeGraph;
codeGraph.text = this.datas.code;
codeGraph.style.fill = esbButtonConsts.codeColor;
codeGraph.setVectorFontSize(esbButtonConsts.codeFontSize);
codeGraph.anchor.set(0.5);
const codeTransform = this.datas?.childTransforms?.find((item) => item.name === 'esb_code');
if (codeTransform) {
const position = codeTransform?.transform.position;
const rotation = codeTransform?.transform?.rotation;
codeGraph.position.set(position?.x, position?.y);
codeGraph.rotation = rotation || 0;
}
else {
codeGraph.position.set(-30, 0);
}
this.circleBody.clear();
this.circleBody.beginFill(this.state.down
? esbButtonConsts.pressedColor
: esbButtonConsts.bodyCircleColor, 1);
this.circleBody.drawCircle(0, 0, esbButtonConsts.bodyCircleRadius);
this.circleBody.endFill();
this.rectBody.clear();
this.rectBody.beginFill(esbButtonConsts.bodyColor, 0);
this.rectBody.lineStyle(esbButtonConsts.bodyRectLineWidth, this.state.down
? esbButtonConsts.pressedColor
: esbButtonConsts.bodyRectLineColor);
this.rectBody.drawRect(-esbButtonConsts.bodyRectWidth / 2, -esbButtonConsts.bodyRectHeight / 2, esbButtonConsts.bodyRectWidth, esbButtonConsts.bodyRectHeight);
this.rectBody.endFill();
this.lineBody.clear();
const lineY = this.datas.flip
? esbButtonConsts.bodyRectHeight / 2
: -esbButtonConsts.bodyRectHeight / 2;
this.lineBody.lineStyle(esbButtonConsts.bodyLineWidth, this.state.down
? esbButtonConsts.pressedColor
: esbButtonConsts.bodyLineColor);
this.lineBody.moveTo(-esbButtonConsts.bodyRectWidth / 2, lineY);
this.lineBody.lineTo(esbButtonConsts.bodyRectWidth / 2, lineY);
}
}
export { EsbButton };

35
components/EsbButton/ZdwxEsbButton.d.ts vendored Normal file
View File

@ -0,0 +1,35 @@
import { Graphics } from 'pixi.js';
import { GraphicData, GraphicState, JlGraphic, VectorText } from 'jl-graphic';
export interface IZdwxEsbData extends GraphicData {
get code(): string;
set code(v: string);
get flip(): boolean;
set flip(v: boolean);
}
export interface IZdwxEsbState extends GraphicState {
id: number;
get down(): boolean;
set down(v: boolean);
}
export declare const zdwxEsbConsts: {
codeFontSize: number;
codeColor: number;
bodyLineColor: number;
lineWidth: number;
bodyRectLineColor: number;
bodyRectLineWidth: number;
bodyRectWidth: number;
bodyRectHeight: number;
bodyCircleRadius: number;
bodyColor: number;
rectOffset: number;
};
export declare class ZdwxEsb extends JlGraphic {
static Type: string;
codeGraph: VectorText;
circleBody: Graphics;
constructor();
get datas(): IZdwxEsbData;
get state(): IZdwxEsbState;
doRepaint(): void;
}

View File

@ -0,0 +1,65 @@
import { Graphics } from 'pixi.js';
import { JlGraphic, VectorText } from 'jl-graphic';
const zdwxEsbConsts = {
codeFontSize: 12,
codeColor: 0xffffff,
bodyLineColor: 0xff0000,
lineWidth: 2,
bodyRectLineColor: 0xff0000,
bodyRectLineWidth: 1,
bodyRectWidth: 20,
bodyRectHeight: 20,
bodyCircleRadius: 4,
bodyColor: 0xff0000,
rectOffset: -10,
};
class ZdwxEsb extends JlGraphic {
static Type = 'esbButton';
codeGraph = new VectorText('');
circleBody = new Graphics();
constructor() {
super(ZdwxEsb.Type);
this.addChild(this.codeGraph);
this.addChild(this.circleBody);
this.codeGraph.name = 'zdwx_esb_code';
}
get datas() {
return this.getDatas();
}
get state() {
return this.getStates();
}
doRepaint() {
const codeGraph = this.codeGraph;
codeGraph.text = this.datas.code;
codeGraph.style.fill = zdwxEsbConsts.codeColor;
codeGraph.setVectorFontSize(zdwxEsbConsts.codeFontSize);
codeGraph.anchor.set(0.5);
const codeTransform = this.datas?.childTransforms?.find((item) => item.name === 'zdwx_esb_code');
if (codeTransform) {
const position = codeTransform?.transform.position;
const rotation = codeTransform?.transform?.rotation;
codeGraph.position.set(position?.x, position?.y);
codeGraph.rotation = rotation || 0;
}
else {
codeGraph.position.set(-30, 0);
}
this.circleBody.clear();
this.circleBody.lineStyle(zdwxEsbConsts.lineWidth, zdwxEsbConsts.bodyColor);
if (this.datas.flip) {
this.circleBody.arc(0, 0, zdwxEsbConsts.bodyCircleRadius, 0, Math.PI);
this.circleBody.moveTo(0, 0);
this.circleBody.lineTo(0, -6);
}
else {
this.circleBody.arc(0, 0, zdwxEsbConsts.bodyCircleRadius, Math.PI, 0);
this.circleBody.moveTo(0, 0);
this.circleBody.lineTo(0, 6);
}
this.circleBody.drawRect(zdwxEsbConsts.rectOffset, zdwxEsbConsts.rectOffset, zdwxEsbConsts.bodyRectWidth, zdwxEsbConsts.bodyRectHeight);
}
}
export { ZdwxEsb, zdwxEsbConsts };

25
components/GatedBox/GatedBox.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
import { Graphics } from 'pixi.js';
import { GraphicData, JlGraphic, VectorText } from 'jl-graphic';
export interface IGatedBox extends GraphicData {
get code(): string;
set code(v: string);
get flip(): boolean;
set flip(v: boolean);
get refScreenDoor(): number;
set refScreenDoor(v: number);
get refGatedBoxMapCode(): string;
set refGatedBoxMapCode(v: string);
clone(): IGatedBox;
copyFrom(data: IGatedBox): void;
eq(other: IGatedBox): boolean;
}
export declare class GatedBox extends JlGraphic {
static Type: string;
codeGraph: VectorText;
rectBody: Graphics;
lineBody: Graphics;
textGraph: VectorText;
constructor();
get datas(): IGatedBox;
doRepaint(): void;
}

View File

@ -0,0 +1,66 @@
import { Graphics } from 'pixi.js';
import { JlGraphic, VectorText } from 'jl-graphic';
const gatedBoxConsts = {
codeFontSize: 12,
codeColor: 0xffffff,
bodyLineColor: 0xffffff,
bodyLineWidth: 4,
bodyRectLineColor: 0xffffff,
bodyRectLineWidth: 2,
bodyRectWidth: 20,
bodyRectHeight: 20,
bodyColor: 0x000000,
};
class GatedBox extends JlGraphic {
static Type = 'gatedBox';
codeGraph = new VectorText('');
rectBody = new Graphics();
lineBody = new Graphics();
textGraph = new VectorText('M');
constructor() {
super(GatedBox.Type);
this.addChild(this.codeGraph);
this.addChild(this.rectBody);
this.addChild(this.lineBody);
this.addChild(this.textGraph);
this.codeGraph.name = 'gated_box_code';
}
get datas() {
return this.getDatas();
}
doRepaint() {
const codeGraph = this.codeGraph;
codeGraph.text = this.datas.code;
codeGraph.style.fill = gatedBoxConsts.codeColor;
codeGraph.setVectorFontSize(gatedBoxConsts.codeFontSize);
const codeTransform = this.datas?.childTransforms?.find((item) => item.name === 'gated_box_code');
if (codeTransform) {
const position = codeTransform?.transform.position;
const rotation = codeTransform?.transform?.rotation;
codeGraph.position.set(position?.x, position?.y);
codeGraph.rotation = rotation || 0;
}
else {
codeGraph.position.set(20, 0);
}
codeGraph.anchor.set(0.5);
this.textGraph.style.fill = gatedBoxConsts.codeColor;
this.textGraph.setVectorFontSize(gatedBoxConsts.codeFontSize);
this.textGraph.anchor.set(0.5);
this.rectBody.clear();
this.rectBody.beginFill(gatedBoxConsts.bodyColor, 0);
this.rectBody.lineStyle(gatedBoxConsts.bodyRectLineWidth, gatedBoxConsts.bodyRectLineColor);
this.rectBody.drawRect(-gatedBoxConsts.bodyRectWidth / 2, -gatedBoxConsts.bodyRectHeight / 2, gatedBoxConsts.bodyRectWidth, gatedBoxConsts.bodyRectHeight);
this.rectBody.endFill();
this.lineBody.clear();
const lineY = this.datas.flip
? gatedBoxConsts.bodyRectHeight / 2
: -gatedBoxConsts.bodyRectHeight / 2;
this.lineBody.lineStyle(gatedBoxConsts.bodyLineWidth, gatedBoxConsts.bodyLineColor);
this.lineBody.moveTo(-gatedBoxConsts.bodyRectWidth / 2, lineY);
this.lineBody.lineTo(gatedBoxConsts.bodyRectWidth / 2, lineY);
}
}
export { GatedBox };

View File

@ -0,0 +1,11 @@
import { GraphicState } from 'jl-graphic';
import { CategoryType } from './PlatformConfig';
import { JlPlatform } from './JlPlatform';
export interface IBeiJingPlatformState extends GraphicState {
id?: number;
}
export declare class BeiJingPlatform extends JlPlatform {
constructor(categoryType: CategoryType);
get states(): IBeiJingPlatformState;
doRepaint(): void;
}

View File

@ -0,0 +1,17 @@
import { BeiJingConsts } from './PlatformConfig.js';
import { JlPlatform } from './JlPlatform.js';
class BeiJingPlatform extends JlPlatform {
constructor(categoryType) {
super(categoryType);
}
get states() {
return this.getStates();
}
doRepaint() {
this.rectGraphic.stateFillColor = BeiJingConsts.noTrainStop;
super.doRepaint();
}
}
export { BeiJingPlatform };

60
components/Platform/JlPlatform.d.ts vendored Normal file
View File

@ -0,0 +1,60 @@
import { JlGraphic, JlGraphicTemplate, VectorText } from 'jl-graphic';
import { Container, Graphics } from 'pixi.js';
import { CategoryType, IPlatformData, PlatformConstsConfig } from './PlatformConfig';
import { IXiAnPlatformState } from './XiAnPlatform';
import { IBeiJingPlatformState } from './BeiJingPlatform';
declare class RectGraphic extends Container {
categoryType: CategoryType;
rect: Graphics;
stateFillColor?: string;
constructor(categoryType: CategoryType);
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
}
declare class DoorGraphic extends Container {
categoryType: CategoryType;
doorGraphic: Graphics;
doorCloseGraphic: Graphics;
stateFillColor?: string;
constructor(categoryType: CategoryType);
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
}
declare class CodeGraphic extends Container {
categoryType: CategoryType;
character: VectorText;
runLevel: VectorText;
runTime: VectorText;
stopTime: VectorText;
circle: Graphics;
constructor(categoryType: CategoryType, platformConsts: PlatformConstsConfig);
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
}
declare class LozengeGraphic extends Container {
categoryType: CategoryType;
lozenge: Graphics;
constructor(categoryType: CategoryType);
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
}
export declare abstract class JlPlatform extends JlGraphic {
static Type: string;
private categoryType;
private platformConsts;
rectGraphic: RectGraphic;
doorGraphic?: DoorGraphic;
lozengeGraphic?: LozengeGraphic;
codeGraphic?: CodeGraphic;
constructor(categoryType: CategoryType);
get datas(): IPlatformData;
doRepaint(): void;
}
export declare class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
hasdoor?: boolean;
direction?: string;
categoryType: CategoryType;
constructor(dataTemplate: IPlatformData, stateTemplate: IXiAnPlatformState | IBeiJingPlatformState, categoryType: CategoryType);
new(): JlPlatform;
}
export {};

View File

@ -1,77 +1,63 @@
import { JlGraphic, calculateMirrorPoint, JlGraphicTemplate, getRectangleCenter, VectorText } from 'jl-graphic';
import { Point, Container, Graphics, Color, Rectangle } from 'pixi.js';
import { platformConstsMap, CategoryType } from './PlatformConfig.js';
import { XiAnPlatform } from './XiAnPlatform.js';
import { BeiJingPlatform } from './BeiJingPlatform.js';
//子元素--矩形
class RectGraphic extends Container {
static Type = 'Rect';
rectGraphic;
constructor() {
categoryType;
rect;
stateFillColor;
constructor(categoryType) {
super();
this.rectGraphic = new Graphics();
this.addChild(this.rectGraphic);
this.categoryType = categoryType;
this.rect = new Graphics();
this.addChild(this.rect);
}
draw(categoryType, stateData, platformConsts) {
const rectGraphic = this.rectGraphic;
let fillColor = platformConsts.noTrainStop;
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (stateXiAn.trainberth) {
fillColor = platformConsts.trainStop;
}
if (stateXiAn.upSkipstop || stateXiAn.downSkipstop) {
fillColor = platformConsts.trainJump;
}
break;
}
rectGraphic
draw(platformConsts) {
const rect = this.rect;
const fillColor = this.stateFillColor || platformConsts.noTrainStop;
rect
.clear()
.lineStyle(platformConsts.lineWidth, new Color(fillColor))
.beginFill(fillColor, 1)
.drawRect(0, 0, platformConsts.width, platformConsts.height).endFill;
rectGraphic.pivot = getRectangleCenter(new Rectangle(0, 0, platformConsts.width, platformConsts.height));
rect.pivot = getRectangleCenter(new Rectangle(0, 0, platformConsts.width, platformConsts.height));
}
clear() {
this.rectGraphic.clear();
this.rect.clear();
}
}
//子元素--门
class DoorGraphic extends Container {
static Type = 'Door';
categoryType;
doorGraphic;
doorCloseGraphic;
constructor() {
stateFillColor;
constructor(categoryType) {
super();
this.categoryType = categoryType;
this.doorGraphic = new Graphics();
this.doorCloseGraphic = new Graphics();
this.addChild(this.doorGraphic);
this.addChild(this.doorCloseGraphic);
}
draw(categoryType, stateData, platformConsts, ipRtuStusDown) {
draw(platformConsts) {
const doorConsts = platformConsts.doorGraphic;
const doorGraphic = this.doorGraphic;
const doorCloseGraphic = this.doorCloseGraphic;
let lineColor = doorConsts.doorGreen;
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (ipRtuStusDown) {
lineColor = doorConsts.blueShowColor;
}
else if (stateXiAn.psdCut) {
lineColor = doorConsts.doorRed;
}
break;
}
doorGraphic.clear()
const lineColor = this.stateFillColor || doorConsts.doorGreen;
doorGraphic
.clear()
.lineStyle(platformConsts.lineWidth, new Color(lineColor))
.moveTo(-platformConsts.width / 2 - platformConsts.lineWidth / 2, 0)
.lineTo(-doorConsts.doorOpenSpacing, 0)
.moveTo(doorConsts.doorOpenSpacing, 0)
.lineTo(platformConsts.width / 2 + platformConsts.lineWidth / 2, 0);
//屏蔽门闭合
doorCloseGraphic.clear()
doorCloseGraphic
.clear()
.lineStyle(platformConsts.lineWidth, new Color(lineColor))
.moveTo(-doorConsts.doorOpenSpacing, 0)
.lineTo(doorConsts.doorOpenSpacing, 0);
@ -80,30 +66,18 @@ class DoorGraphic extends Container {
this.doorGraphic.clear();
this.doorCloseGraphic.clear();
}
changeState(categoryType, stateData) {
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (stateXiAn.psdOpen) {
this.doorCloseGraphic.visible = false;
}
else {
this.doorCloseGraphic.visible = true;
}
break;
}
}
}
//子元素--字符
class CodeGraph extends Container {
static Type = 'Code';
class CodeGraphic extends Container {
categoryType;
character = new VectorText(''); //扣车H
runLevel = new VectorText(''); //运行等级
runTime = new VectorText(''); //运行时间
stopTime = new VectorText(''); //停站时间
circle = new Graphics();
constructor(platformConsts) {
constructor(categoryType, platformConsts) {
super();
this.categoryType = categoryType;
this.addChild(this.character);
this.addChild(this.runLevel);
this.addChild(this.circle);
@ -126,7 +100,8 @@ class CodeGraph extends Container {
(codeConsts.besideSpacing * 2) / 3, (platformConsts.height * 3) / 4);
character.style.fill = codeConsts.whiteNumbers;
const circle = this.circle;
circle.clear()
circle
.clear()
.lineStyle(0.5, codeConsts.whiteCircle)
.drawCircle(0, 0, codeConsts.circleRadius);
circle.position.set(-platformConsts.width / 2 -
@ -162,161 +137,94 @@ class CodeGraph extends Container {
clear() {
this.character.destroy();
}
changeState(categoryType, stateData, platformConsts) {
const codeConsts = platformConsts.codeGraphic;
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (stateXiAn.upHold ||
stateXiAn.upOccHold ||
stateXiAn.downHold ||
stateXiAn.downOccHold) {
this.character.text = 'H';
this.character.visible = true;
this.circle.visible = true;
//上行扣车
if (stateXiAn.upHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateXiAn.upOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateXiAn.upHold && stateXiAn.upOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
//下行扣车
if (stateXiAn.downHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateXiAn.downOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateXiAn.downHold && stateXiAn.downOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
}
//运行等级
if (stateXiAn.nextSectionRunLevel) {
this.runLevel.visible = false;
this.runLevel.text = stateXiAn.nextSectionRunLevel;
}
//运行时间
if (stateXiAn.nextSectionRunTime) {
this.runTime.visible = true;
this.runTime.text = stateXiAn.nextSectionRunTime;
}
//停站时间
if (stateXiAn.stopTime) {
this.stopTime.visible = true;
this.stopTime.text = stateXiAn.stopTime;
}
break;
}
}
}
//子元素--站台旁菱形图标
class LozengeGraphic extends Container {
static Type = 'lozengeGraphic';
lozengeGraphic;
constructor() {
categoryType;
lozenge;
constructor(categoryType) {
super();
this.lozengeGraphic = new Graphics();
this.addChild(this.lozengeGraphic);
this.categoryType = categoryType;
this.lozenge = new Graphics();
this.addChild(this.lozenge);
}
draw(platformConsts) {
const LozengeConsts = platformConsts.lozengeGraphic;
const lozengeGraphic = this.lozengeGraphic;
lozengeGraphic.clear()
const lozenge = this.lozenge;
lozenge
.clear()
.lineStyle(1, new Color(LozengeConsts.lozengeRed))
.beginFill(LozengeConsts.lozengeRed, 1)
.drawRect(0, 0, platformConsts.height / 4, platformConsts.height / 4)
.endFill();
const rect = new Rectangle(0, 0, platformConsts.height / 4, platformConsts.height / 4);
lozengeGraphic.pivot = getRectangleCenter(rect);
lozengeGraphic.rotation = Math.PI / 4;
lozengeGraphic.visible = false;
lozenge.pivot = getRectangleCenter(rect);
lozenge.rotation = Math.PI / 4;
lozenge.visible = false;
}
clear() {
this.lozengeGraphic.clear();
}
changeState(categoryType, stateData) {
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (stateXiAn.emergstop) {
this.lozengeGraphic.visible = true;
}
else {
this.lozengeGraphic.visible = false;
}
break;
}
this.lozenge.clear();
}
}
class Platform extends JlGraphic {
class JlPlatform extends JlGraphic {
static Type = 'Platform';
categoryType;
rectGraphic = new RectGraphic();
platformConsts;
rectGraphic;
doorGraphic;
lozengeGraphic;
codeGraph;
codeGraphic;
constructor(categoryType) {
super(Platform.Type);
super(JlPlatform.Type);
this.categoryType = categoryType;
const platformConsts = platformConstsMap.get(this.categoryType);
this.platformConsts = platformConstsMap.get(this.categoryType);
this.rectGraphic = new RectGraphic(categoryType);
this.addChild(this.rectGraphic);
if (platformConsts.doorGraphic) {
this.doorGraphic = new DoorGraphic();
if (this.platformConsts.doorGraphic) {
this.doorGraphic = new DoorGraphic(categoryType);
this.addChild(this.doorGraphic);
}
if (platformConsts.lozengeGraphic) {
this.lozengeGraphic = new LozengeGraphic();
if (this.platformConsts.lozengeGraphic) {
this.lozengeGraphic = new LozengeGraphic(categoryType);
this.addChild(this.lozengeGraphic);
}
if (platformConsts.codeGraphic) {
this.codeGraph = new CodeGraph(platformConsts);
this.addChild(this.codeGraph);
if (this.platformConsts.codeGraphic) {
this.codeGraphic = new CodeGraphic(categoryType, this.platformConsts);
this.addChild(this.codeGraphic);
}
}
get datas() {
return this.getDatas();
}
get states() {
return this.getStates();
}
doRepaint() {
this.doorGraphic?.clear();
const platformConsts = platformConstsMap.get(this.categoryType);
this.rectGraphic.draw(this.categoryType, this.states, platformConsts);
if (this.datas.hasdoor && this.doorGraphic) {
const platformConsts = this.platformConsts;
this.rectGraphic.draw(platformConsts);
if (this.doorGraphic) {
const doorConsts = platformConsts.doorGraphic;
/* const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
states.rtuId > 9 ? '' + states.rtuId : '0' + states.rtuId,
Station.Type
); */
this.doorGraphic.draw(this.categoryType, this.states, platformConsts, false);
this.doorGraphic.draw(platformConsts);
this.doorGraphic.position.set(0, -platformConsts.height / 2 - doorConsts.doorPlatformSpacing);
if (this.datas.direction == 'down') {
this.doorGraphic.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.doorGraphic.position));
}
}
if (this.codeGraph) {
if (this.codeGraphic) {
const codeConsts = platformConsts.codeGraphic;
this.codeGraph.draw(platformConsts);
this.codeGraph.position.set(0, 0);
this.codeGraphic.draw(platformConsts);
this.codeGraphic.position.set(0, 0);
if (this.datas.direction == 'down') {
const psChange = [
this.codeGraph?.character,
this.codeGraph?.runLevel,
this.codeGraph?.stopTime,
this.codeGraph?.circle,
this.codeGraphic.character,
this.codeGraphic.runLevel,
this.codeGraphic.stopTime,
this.codeGraphic.runTime,
];
psChange.forEach((g) => {
if (g) {
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), g.position));
}
});
this.codeGraph?.runTime.position.set(platformConsts.width / 2 +
this.codeGraphic.circle.position.set(platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
(codeConsts.besideSpacing * 4) / 3, (-platformConsts.height * 10) / 11);
}
@ -331,27 +239,36 @@ class Platform extends JlGraphic {
this.lozengeGraphic.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.lozengeGraphic.position));
}
}
this.changeState();
}
changeState() {
const platformConsts = platformConstsMap.get(this.categoryType);
this.doorGraphic?.changeState(this.categoryType, this.states);
this.lozengeGraphic?.changeState(this.categoryType, this.states);
this.codeGraph?.changeState(this.categoryType, this.states, platformConsts);
}
}
class PlatformTemplate extends JlGraphicTemplate {
hasdoor;
direction;
categoryType;
constructor(dataTemplate, stateTemplate, categoryType) {
super(Platform.Type, { dataTemplate, stateTemplate });
super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.categoryType = categoryType;
switch (this.categoryType) {
case CategoryType.XiAn:
this.hasdoor = true;
this.direction = 'up';
break;
}
}
new() {
const g = new Platform(this.categoryType);
g.loadData(this.datas);
g.loadState(this.states);
return g;
switch (this.categoryType) {
case CategoryType.BeiJing:
const BeiJing = new BeiJingPlatform(CategoryType.BeiJing);
BeiJing.loadData(this.datas);
BeiJing.loadState(this.states);
return BeiJing;
default:
const XiAn = new XiAnPlatform(CategoryType.XiAn);
XiAn.loadData(this.datas);
XiAn.loadState(this.states);
return XiAn;
}
}
}
export { Platform, PlatformTemplate };
export { JlPlatform, PlatformTemplate };

View File

@ -1,59 +0,0 @@
import { JlGraphic, JlGraphicTemplate, VectorText } from "jl-graphic";
import { Container, Graphics } from 'pixi.js';
import { CategoryType, IBeiJingPlatformState, IPlatformData, IXiAnPlatformState, PlatformConstsConfig } from './PlatformConfig';
type IPlatformState = IBeiJingPlatformState | IXiAnPlatformState;
declare class RectGraphic extends Container {
static Type: string;
rectGraphic: Graphics;
constructor();
draw(categoryType: CategoryType, stateData: IPlatformState, platformConsts: PlatformConstsConfig): void;
clear(): void;
}
declare class DoorGraphic extends Container {
static Type: string;
doorGraphic: Graphics;
doorCloseGraphic: Graphics;
constructor();
draw(categoryType: CategoryType, stateData: IPlatformState, platformConsts: PlatformConstsConfig, ipRtuStusDown: boolean): void;
clear(): void;
changeState(categoryType: CategoryType, stateData: IPlatformState): void;
}
declare class CodeGraph extends Container {
static Type: string;
character: VectorText;
runLevel: VectorText;
runTime: VectorText;
stopTime: VectorText;
circle: Graphics;
constructor(platformConsts: PlatformConstsConfig);
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
changeState(categoryType: CategoryType, stateData: IPlatformState, platformConsts: PlatformConstsConfig): void;
}
declare class LozengeGraphic extends Container {
static Type: string;
lozengeGraphic: Graphics;
constructor();
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
changeState(categoryType: CategoryType, stateData: IPlatformState): void;
}
export declare class Platform extends JlGraphic {
static Type: string;
private categoryType;
rectGraphic: RectGraphic;
doorGraphic?: DoorGraphic;
lozengeGraphic?: LozengeGraphic;
codeGraph?: CodeGraph;
constructor(categoryType: CategoryType);
get datas(): IPlatformData;
get states(): IPlatformState;
doRepaint(): void;
changeState(): void;
}
export declare class PlatformTemplate extends JlGraphicTemplate<Platform> {
categoryType: CategoryType;
constructor(dataTemplate: IPlatformData, stateTemplate: IPlatformState, categoryType: CategoryType);
new(): Platform;
}
export {};

View File

@ -1,4 +1,4 @@
import { GraphicData, GraphicState } from "jl-graphic";
import { GraphicData } from 'jl-graphic';
export declare enum CategoryType {
BeiJing = "BeiJing",//北京
XiAn = "XiAn"
@ -19,23 +19,59 @@ export interface DoorConstsConfig {
doorRed: string;
doorBlue: string;
doorOpenSpacing: number;
blueShowColor: string;
doorPlatformSpacing: number;
}
export interface CodeConstsConfig {
circleRadius: number;
besideSpacing: number;
besideFontSize: number;
whiteNumbers: string;
whiteCircle: string;
circleRadius: number;
HCharYellow: string;
HCharWhite: string;
HCharRed: string;
}
export interface LozengeConstsConfig {
lozengeRed?: string;
lozengeRed: string;
doorPlatformSpacing: number;
}
export declare const BeiJingConsts: {
width: number;
height: number;
lineWidth: number;
noTrainStop: string;
trainStop: string;
trainJump: string;
};
export declare const XiAnConsts: {
width: number;
height: number;
lineWidth: number;
noTrainStop: string;
trainStop: string;
trainJump: string;
doorGraphic: {
doorOpenSpacing: number;
doorGreen: string;
doorRed: string;
doorBlue: string;
doorPlatformSpacing: number;
};
codeGraphic: {
circleRadius: number;
besideSpacing: number;
besideFontSize: number;
whiteNumbers: string;
whiteCircle: string;
HCharYellow: string;
HCharWhite: string;
HCharRed: string;
};
lozengeGraphic: {
lozengeRed: string;
doorPlatformSpacing: number;
};
};
export declare const platformConstsMap: Map<CategoryType, PlatformConstsConfig>;
declare enum TypeOfPlatform {
Unknown = 0,
@ -56,43 +92,4 @@ export interface IPlatformData extends GraphicData {
copyFrom(data: IPlatformData): void;
eq(other: IPlatformData): boolean;
}
export interface IXiAnPlatformState extends GraphicState {
get emergstop(): boolean;
set emergstop(v: boolean);
get trainberth(): boolean;
set trainberth(v: boolean);
get close(): boolean;
set close(v: boolean);
get upHold(): boolean;
set upHold(v: boolean);
get downHold(): boolean;
set downHold(v: boolean);
get upOccHold(): boolean;
set upOccHold(v: boolean);
get downOccHold(): boolean;
set downOccHold(v: boolean);
get psdOpen(): boolean;
set psdOpen(v: boolean);
get psdCut(): boolean;
set psdCut(v: boolean);
get upSkipstop(): boolean;
set upSkipstop(v: boolean);
get downSkipstop(): boolean;
set downSkipstop(v: boolean);
get upTrainSkipstop(): boolean;
set upTrainSkipstop(v: boolean);
get downTrainSkipstop(): boolean;
set downTrainSkipstop(v: boolean);
get nextSectionRunTime(): number;
set nextSectionRunTime(v: number);
get nextSectionRunLevel(): number;
set nextSectionRunLevel(v: number);
get stopTime(): number;
set stopTime(v: number);
get rtuId(): number;
set rtuId(v: number);
}
export interface IBeiJingPlatformState extends GraphicState {
id?: number;
}
export {};

View File

@ -18,13 +18,11 @@ const XiAnConsts = {
noTrainStop: '0x7F7F7F',
trainStop: '0xfbff00',
trainJump: '0xC0C0FE',
blueShowColor: '0x3149c3',
doorGraphic: {
blueShowColor: '0x3149c3',
doorOpenSpacing: 15,
doorGreen: '0x00FF00',
doorRed: '0xff0000',
doorBlue: '0x4048C4',
doorBlue: '0x3149c3',
doorPlatformSpacing: 10,
},
codeGraphic: {
@ -42,7 +40,10 @@ const XiAnConsts = {
doorPlatformSpacing: 10,
},
};
const platformConstsMap = new Map([[CategoryType.BeiJing, BeiJingConsts], [CategoryType.XiAn, XiAnConsts]]);
const platformConstsMap = new Map([
[CategoryType.BeiJing, BeiJingConsts],
[CategoryType.XiAn, XiAnConsts],
]);
var TypeOfPlatform;
(function (TypeOfPlatform) {
TypeOfPlatform[TypeOfPlatform["Unknown"] = 0] = "Unknown";
@ -50,4 +51,4 @@ var TypeOfPlatform;
TypeOfPlatform[TypeOfPlatform["down"] = 2] = "down";
})(TypeOfPlatform || (TypeOfPlatform = {}));
export { CategoryType, platformConstsMap };
export { BeiJingConsts, CategoryType, XiAnConsts, platformConstsMap };

44
components/Platform/XiAnPlatform.d.ts vendored Normal file
View File

@ -0,0 +1,44 @@
import { GraphicState } from 'jl-graphic';
import { CategoryType } from './PlatformConfig';
import { JlPlatform } from './JlPlatform';
export interface IXiAnPlatformState extends GraphicState {
get emergstop(): boolean;
set emergstop(v: boolean);
get trainberth(): boolean;
set trainberth(v: boolean);
get close(): boolean;
set close(v: boolean);
get upHold(): boolean;
set upHold(v: boolean);
get downHold(): boolean;
set downHold(v: boolean);
get upOccHold(): boolean;
set upOccHold(v: boolean);
get downOccHold(): boolean;
set downOccHold(v: boolean);
get psdOpen(): boolean;
set psdOpen(v: boolean);
get psdCut(): boolean;
set psdCut(v: boolean);
get upSkipstop(): boolean;
set upSkipstop(v: boolean);
get downSkipstop(): boolean;
set downSkipstop(v: boolean);
get upTrainSkipstop(): boolean;
set upTrainSkipstop(v: boolean);
get downTrainSkipstop(): boolean;
set downTrainSkipstop(v: boolean);
get nextSectionRunTime(): number;
set nextSectionRunTime(v: number);
get nextSectionRunLevel(): number;
set nextSectionRunLevel(v: number);
get stopTime(): number;
set stopTime(v: number);
get rtuId(): number;
set rtuId(v: number);
}
export declare class XiAnPlatform extends JlPlatform {
constructor(categoryType: CategoryType);
get states(): IXiAnPlatformState;
doRepaint(): void;
}

View File

@ -0,0 +1,102 @@
import { XiAnConsts } from './PlatformConfig.js';
import { JlPlatform } from './JlPlatform.js';
class XiAnPlatform extends JlPlatform {
constructor(categoryType) {
super(categoryType);
}
get states() {
return this.getStates();
}
doRepaint() {
this.rectGraphic.stateFillColor = XiAnConsts.noTrainStop;
if (this.states.trainberth) {
this.rectGraphic.stateFillColor = XiAnConsts.trainStop;
}
if (this.states.upSkipstop || this.states.downSkipstop) {
this.rectGraphic.stateFillColor = XiAnConsts.trainJump;
}
/* const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId,
Station.Type
); */
if (this.doorGraphic) {
this.doorGraphic.stateFillColor = XiAnConsts.doorGraphic.doorGreen;
/* if (!!station?.states.ipRtuStusDown) {
this.doorGraphic.stateFillColor = XiAnConsts.doorGraphic.doorBlue;
} */ if (this.states.psdCut) {
this.doorGraphic.stateFillColor = XiAnConsts.doorGraphic.doorRed;
}
}
super.doRepaint();
if (this.doorGraphic) {
if (this.states.psdOpen) {
this.doorGraphic.doorCloseGraphic.visible = false;
}
else {
this.doorGraphic.doorCloseGraphic.visible = true;
}
}
if (this.lozengeGraphic) {
if (this.states.emergstop) {
this.lozengeGraphic.lozenge.visible = true;
}
else {
this.lozengeGraphic.lozenge.visible = false;
}
}
if (this.codeGraphic) {
if (this.states.upHold ||
this.states.upOccHold ||
this.states.downHold ||
this.states.downOccHold) {
this.codeGraphic.character.text = 'H';
this.codeGraphic.character.visible = true;
this.codeGraphic.circle.visible = true;
//上行扣车
if (this.states.upHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharYellow;
}
if (this.states.upOccHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharWhite;
}
if (this.states.upHold && this.states.upOccHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharRed;
}
//下行扣车
if (this.states.downHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharYellow;
}
if (this.states.downOccHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharWhite;
}
if (this.states.downHold && this.states.downOccHold) {
this.codeGraphic.character.style.fill =
XiAnConsts.codeGraphic.HCharRed;
}
}
//运行等级
if (this.states.nextSectionRunLevel) {
this.codeGraphic.runLevel.visible = false;
this.codeGraphic.runLevel.text = this.states.nextSectionRunLevel;
}
//运行时间
if (this.states.nextSectionRunTime) {
this.codeGraphic.runTime.visible = true;
this.codeGraphic.runTime.text = this.states.nextSectionRunTime;
}
//停站时间
if (this.states.stopTime) {
this.codeGraphic.stopTime.visible = true;
this.codeGraphic.stopTime.text = this.states.stopTime;
}
}
}
}
export { XiAnPlatform };

View File

@ -1,20 +1,18 @@
import { Graphics } from 'pixi.js';
import { JlGraphic, JlGraphicTemplate } from 'jl-graphic';
import { ISeparatorData } from './SeparatorConfig';
import { CategoryType } from '../CategoryType';
import { JlGraphic } from 'jl-graphic';
import { ISeparatorConsts, ISeparatorData, UpdateSeparatorConsts } from './SeparatorConfig';
/**
*
* @param {UpdateSeparatorConsts}
*
*/
export declare class Separator extends JlGraphic {
static Type: string;
rectGraphic: Graphics;
circleGraphic: Graphics;
private categoryType;
constructor(categoryType: CategoryType);
constDatas: ISeparatorConsts;
constructor(data?: UpdateSeparatorConsts);
get datas(): ISeparatorData;
getConstDatas(): void;
clear(): void;
doRepaint(): void;
}
export declare class SeparatorTemplate extends JlGraphicTemplate<Separator> {
categoryType: CategoryType;
constructor(dataTemplate: ISeparatorData, gategoryConsts: CategoryType);
new(): Separator;
}

View File

@ -1,35 +1,29 @@
import { Graphics, Color } from 'pixi.js';
import { JlGraphic, JlGraphicTemplate } from 'jl-graphic';
import { SeparatorConstsMap, separatorTypeEnum } from './SeparatorConfig.js';
import { JlGraphic } from 'jl-graphic';
import { getSeparatorConsts, separatorTypeEnum } from './SeparatorConfig.js';
let SeparatorConsts = {
height: 12,
lineWidth: 2,
lineColor: '0xFFFFFF',
circleColor: '0xEF0200',
radius: 5,
};
/**
* 分隔符
* @param {UpdateSeparatorConsts}常量数据
*
*/
class Separator extends JlGraphic {
static Type = 'Separator';
rectGraphic = new Graphics();
circleGraphic = new Graphics();
categoryType;
constructor(categoryType) {
constDatas;
constructor(data) {
super(Separator.Type);
this.addChild(this.rectGraphic);
this.addChild(this.circleGraphic);
this.categoryType = categoryType;
this.getConstDatas();
this.constDatas = getSeparatorConsts();
if (data) {
Object.assign(this.constDatas, data);
}
}
get datas() {
return this.getDatas();
}
getConstDatas() {
const constData = SeparatorConstsMap.get(this.categoryType);
if (constData) {
SeparatorConsts = constData;
}
}
clear() {
this.rectGraphic.clear();
this.circleGraphic.clear();
@ -42,21 +36,21 @@ class Separator extends JlGraphic {
}
const typeArr = ['section', 'turnout'];
if (typeArr.includes(this.datas.separatorType)) {
rectGraphic.lineStyle(SeparatorConsts.lineWidth, new Color(SeparatorConsts.lineColor));
rectGraphic.moveTo(0, -SeparatorConsts.height / 2);
rectGraphic.lineTo(0, SeparatorConsts.height / 2);
rectGraphic.lineStyle(this.constDatas.lineWidth, new Color(this.constDatas.lineColor));
rectGraphic.moveTo(0, -this.constDatas.height / 2);
rectGraphic.lineTo(0, this.constDatas.height / 2);
if (this.datas.separatorType == 'turnout') {
this.circleGraphic.lineStyle(1, SeparatorConsts.circleColor);
this.circleGraphic.drawCircle(0, 0, SeparatorConsts.radius);
this.circleGraphic.lineStyle(1, this.constDatas.circleColor);
this.circleGraphic.drawCircle(0, 0, this.constDatas.radius);
}
}
const endTypeArr = ['endA', 'endB'];
if (endTypeArr.includes(this.datas.separatorType)) {
let d = SeparatorConsts.radius;
let d = this.constDatas.radius;
if (this.datas.separatorType == 'endB') {
d = -d;
}
rectGraphic.lineStyle(SeparatorConsts.lineWidth, new Color(SeparatorConsts.lineColor));
rectGraphic.lineStyle(this.constDatas.lineWidth, new Color(this.constDatas.lineColor));
rectGraphic.moveTo(0, 0);
rectGraphic.lineTo(-d, 0);
rectGraphic.lineTo(-d, -d);
@ -67,19 +61,5 @@ class Separator extends JlGraphic {
}
}
}
class SeparatorTemplate extends JlGraphicTemplate {
categoryType;
constructor(dataTemplate, gategoryConsts) {
super(Separator.Type, {
dataTemplate,
});
this.categoryType = gategoryConsts;
}
new() {
const separator = new Separator(this.categoryType);
separator.loadData(this.datas);
return separator;
}
}
export { Separator, SeparatorTemplate };
export { Separator };

View File

@ -1,19 +1,18 @@
import { GraphicData } from "jl-graphic";
import { CategoryType } from "../CategoryType";
export declare enum separatorTypeEnum {
turnout = "turnout",// 道岔分隔符
endA = "endA",// A端尽头分隔符
endB = "endB",// B端尽头分隔符
section = "section"
}
export interface SeparatorConstsConfig {
export interface ISeparatorConsts {
height: number;
lineWidth: number;
lineColor: string;
circleColor: string;
radius: number;
}
export declare const SeparatorConstsMap: Map<CategoryType, SeparatorConstsConfig>;
export type UpdateSeparatorConsts = Partial<ISeparatorConsts>;
export interface ISeparatorData extends GraphicData {
get code(): string;
set code(v: string);
@ -23,3 +22,4 @@ export interface ISeparatorData extends GraphicData {
copyFrom(data: ISeparatorData): void;
eq(other: ISeparatorData): boolean;
}
export declare function getSeparatorConsts(): ISeparatorConsts;

View File

@ -1,5 +1,3 @@
import { CategoryType } from '../CategoryType.js';
var separatorTypeEnum;
(function (separatorTypeEnum) {
separatorTypeEnum["turnout"] = "turnout";
@ -7,20 +5,15 @@ var separatorTypeEnum;
separatorTypeEnum["endB"] = "endB";
separatorTypeEnum["section"] = "section";
})(separatorTypeEnum || (separatorTypeEnum = {}));
const THConsts = {
height: 12,
lineWidth: 2,
lineColor: '0xFFFFFF',
circleColor: '0xEF0200',
radius: 5,
};
const JKConsts = {
height: 12,
lineWidth: 2,
lineColor: '0x617799',
circleColor: '0xEF0200',
radius: 5,
};
const SeparatorConstsMap = new Map([[CategoryType.JK, JKConsts], [CategoryType.TH, THConsts]]);
function getSeparatorConsts() {
const separatorConsts = {
height: 12,
lineWidth: 2,
lineColor: '0x617799',
circleColor: '0xEF0200',
radius: 5,
};
return separatorConsts;
}
export { SeparatorConstsMap, separatorTypeEnum };
export { getSeparatorConsts, separatorTypeEnum };

View File

@ -0,0 +1,20 @@
import { Graphics, Container } from 'pixi.js';
import { Lamp } from '../common/Lamp';
import { Model } from './Signal';
export declare class LampMainBody extends Container {
static Type: string;
lampNum: number;
lampPost: Graphics;
lamps: Lamp[];
mirror: boolean;
paint(mt: Model, mirror: boolean): void;
setStateBlueShow(): void;
setStateLogic(): void;
setStateH(): void;
setStateL(): void;
setStateU(): void;
setStateHu(): void;
setStateA(): void;
setStateB(): void;
setStateOff(): void;
}

View File

@ -0,0 +1,100 @@
import { Container, Graphics, Point } from 'pixi.js';
import { calculateMirrorPoint } from 'jl-graphic';
import { Lamp } from '../common/Lamp.js';
import { Model, signalConsts, SignalColorEnum } from './Signal.js';
class LampMainBody extends Container {
static Type = 'LampMainBody';
lampNum = 1;
lampPost = new Graphics();
lamps = [];
mirror = false;
paint(mt, mirror) {
this.mirror = mirror;
if (mt === Model.HL ||
mt === Model.AB) {
this.lampNum = 2;
}
else {
this.lampNum = 3;
}
this.removeChildren(0);
this.lampPost = new Graphics();
let lpp = new Point(signalConsts.levelLampPostLength, 0);
if (mirror) {
lpp = calculateMirrorPoint(new Point(0, 0), lpp);
}
this.lampPost
.lineStyle(signalConsts.postLineWidth, SignalColorEnum.lampPostColor)
.moveTo(0, -signalConsts.verticalLampPostLength / 2)
.lineTo(0, signalConsts.verticalLampPostLength / 2)
.moveTo(0, 0)
.lineTo(lpp.x, lpp.y);
this.addChild(this.lampPost);
this.lamps = [];
for (let i = 0; i < this.lampNum; i++) {
const lamp = new Lamp(false);
this.addChild(lamp);
const radiusX = (1 + i * 2) * signalConsts.lampRadius +
signalConsts.levelLampPostLength;
let lrp = new Point(radiusX, 0);
if (mirror) {
lrp = calculateMirrorPoint(new Point(0, 0), lrp);
}
lamp.paint(lrp.x, lrp.y);
this.lamps.push(lamp);
}
}
setStateBlueShow() {
this.lamps.forEach(lamp => {
lamp.createLamp(SignalColorEnum.blueLamp);
});
}
setStateLogic() {
this.lamps.forEach(lamp => {
lamp.createLogicMode();
});
}
setStateH() {
this.lamps[0].createLamp(SignalColorEnum.redLamp);
this.lamps.forEach((lamp, index) => {
if (index !== 0) {
lamp.createLamp(SignalColorEnum.closeLamp);
}
});
}
setStateL() {
this.lamps[1].createLamp(SignalColorEnum.greenLamp);
this.lamps.forEach((lamp, index) => {
if (index !== 1) {
lamp.createLamp(SignalColorEnum.closeLamp);
}
});
}
setStateU() {
this.lamps[2].createLamp(SignalColorEnum.yellowLamp);
this.lamps.forEach((lamp, index) => {
if (index !== 2) {
lamp.createLamp(SignalColorEnum.closeLamp);
}
});
}
setStateHu() {
this.lamps[0].createLamp(SignalColorEnum.redLamp);
this.lamps[1].createLamp(SignalColorEnum.closeLamp);
this.lamps[2].createLamp(SignalColorEnum.yellowLamp);
}
setStateA() {
this.lamps[0].createLamp(SignalColorEnum.blueLamp);
this.lamps[1].createLamp(SignalColorEnum.closeLamp);
}
setStateB() {
this.lamps[0].createLamp(SignalColorEnum.whiteLamp);
this.lamps[1].createLamp(SignalColorEnum.closeLamp);
}
setStateOff() {
this.lamps.forEach((lamp) => lamp.createLamp(SignalColorEnum.closeLamp));
}
}
export { LampMainBody };

154
components/Signal/bjRtss/Signal.d.ts vendored Normal file
View File

@ -0,0 +1,154 @@
import { Graphics } from 'pixi.js';
import { GraphicData, JlGraphic, GraphicState, JlGraphicTemplate } from 'jl-graphic';
import { LampMainBody } from './LampMainBody';
import { SignalCode } from '../common/SignalCode';
/** 信号机类型 */
export declare enum Model {
HL = 0,// 红绿灯
HLU_FU = 1,// 红绿黄,封黄灯,无引导
HLU_DU_YY = 2,// 红绿黄,不封灯,有单黄,带引导
HLU_YY = 3,// 红绿黄,不封灯,无单黄,带引导
HLU_FL_DU_YY = 4,// 红绿黄,封绿灯,有单黄,带引导
HLU_DU = 5,// 红绿黄,不封灯,有单黄,无引导
AB = 6,// 蓝白
HBU_DU = 7
}
export declare enum Direction {
LEFT = 0,
RIGHT = 1
}
export declare enum DeviceType {
Section = 0,
Turnout = 1,
TrainWindow = 2,
AxleCounting = 3,
SectionLink = 4,
signal = 5,
station = 6,
ScreenDoor = 7,
SignalFaultAlarm = 8,
Breakers = 9,
PowerScreen = 10
}
export declare enum Aspect {
Non = 0,
OFF = 1,
L = 2,
H = 3,
U = 4,
HU = 5,
B = 6,
A = 7
}
export declare enum DevicePort {
A = 0,
B = 1,
C = 2
}
export interface KilometerSystem {
get coordinateSystem(): string;
set coordinateSystem(v: string);
get kilometer(): number;
set kilometer(v: number);
get direction(): Direction;
set direction(v: Direction);
}
export interface IRelatedRefData {
deviceType: DeviceType;
id: number;
devicePort: DevicePort;
}
export interface ISignalData extends GraphicData {
get code(): string;
set code(v: string);
get mirror(): boolean;
set mirror(v: boolean);
get kilometerSystem(): KilometerSystem;
set kilometerSystem(v: KilometerSystem);
get refDev(): IRelatedRefData;
set refDev(v: IRelatedRefData);
get centralizedStations(): number[];
set centralizedStations(v: number[]);
get mt(): Model;
set mt(v: Model);
get direction(): Direction;
set direction(v: Direction);
clone(): ISignalData;
copyFrom(data: ISignalData): void;
eq(other: ISignalData): boolean;
}
export interface ISignalState extends GraphicState {
id?: string;
get aspect(): number;
set aspect(v: number);
}
export declare enum SignalColorEnum {
humanControlColor = "0xffff00",
fleetModeColor = "0x00ff00",
blockedColor = "0XFF0000",
defaultCodeColor = "0XFFFFFF",
lampPostColor = "0xFFFFFF",
redLamp = "0XFF0000",
greenLamp = "0X00FF00",
yellowLamp = "0XFFFF00",
whiteLamp = "0XFFFFFF",
blueLamp = "0X0033FF",
closeLamp = "0X000000",
logicModeColor = "0x000000",
lampLineColor = "0x3149c3"
}
export declare const signalConsts: {
fleetModeLength: number;
fleetModeRadius: number;
fleetModeLineWidth: number;
humanControlRadius: number;
codeOffset: number;
codeFontSize: number;
blockedLineWidth: number;
verticalLampPostLength: number;
levelLampPostLength: number;
postLineWidth: number;
lampRadius: number;
logicModeLineWidth: number;
logicModeDistance: number;
lampLineWidth: number;
};
export declare class Signal extends JlGraphic {
static Type: string;
signalCode: SignalCode;
humanControl: Graphics;
fleetMode: Graphics;
lampMainBody: LampMainBody;
blockedMode: Graphics;
constructor();
get datas(): ISignalData;
get mirror(): boolean;
set mirror(v: boolean);
get states(): ISignalState;
paint(): void;
doRepaint(): void;
chagneState(): void;
/** 设置状态自动进路 */
/** 设置状态人工控 */
/** 设置状态封锁 */
/** 设置状态红灯 */
setStateH(): void;
/** 设置状态绿灯 */
setStateL(): void;
/** 设置状态黄灯 */
setStateU(): void;
/** 设置状态红黄灯 */
setStateHu(): void;
/** 设置状态白灯 */
setStateA(): void;
/** 设置状态蓝灯 */
setStateB(): void;
/** 设置状态灯位关闭 */
setStateOff(): void;
buildRelation(): void;
loadRelations(): void;
}
export declare class SignalTemplate extends JlGraphicTemplate<Signal> {
constructor(dataTemplate: ISignalData, stateTemplate: ISignalState);
new(): Signal;
}

View File

@ -0,0 +1,250 @@
import { Graphics } from 'pixi.js';
import { JlGraphic, GraphicRelationParam, JlGraphicTemplate } from 'jl-graphic';
import { LampMainBody } from './LampMainBody.js';
import { SignalCode } from '../common/SignalCode.js';
/** 信号机类型 */
var Model;
(function (Model) {
Model[Model["HL"] = 0] = "HL";
Model[Model["HLU_FU"] = 1] = "HLU_FU";
Model[Model["HLU_DU_YY"] = 2] = "HLU_DU_YY";
Model[Model["HLU_YY"] = 3] = "HLU_YY";
Model[Model["HLU_FL_DU_YY"] = 4] = "HLU_FL_DU_YY";
Model[Model["HLU_DU"] = 5] = "HLU_DU";
Model[Model["AB"] = 6] = "AB";
Model[Model["HBU_DU"] = 7] = "HBU_DU";
})(Model || (Model = {}));
var Direction;
(function (Direction) {
Direction[Direction["LEFT"] = 0] = "LEFT";
Direction[Direction["RIGHT"] = 1] = "RIGHT";
})(Direction || (Direction = {}));
var DeviceType;
(function (DeviceType) {
DeviceType[DeviceType["Section"] = 0] = "Section";
DeviceType[DeviceType["Turnout"] = 1] = "Turnout";
DeviceType[DeviceType["TrainWindow"] = 2] = "TrainWindow";
DeviceType[DeviceType["AxleCounting"] = 3] = "AxleCounting";
DeviceType[DeviceType["SectionLink"] = 4] = "SectionLink";
DeviceType[DeviceType["signal"] = 5] = "signal";
DeviceType[DeviceType["station"] = 6] = "station";
DeviceType[DeviceType["ScreenDoor"] = 7] = "ScreenDoor";
DeviceType[DeviceType["SignalFaultAlarm"] = 8] = "SignalFaultAlarm";
DeviceType[DeviceType["Breakers"] = 9] = "Breakers";
DeviceType[DeviceType["PowerScreen"] = 10] = "PowerScreen";
})(DeviceType || (DeviceType = {}));
var Aspect;
(function (Aspect) {
Aspect[Aspect["Non"] = 0] = "Non";
Aspect[Aspect["OFF"] = 1] = "OFF";
Aspect[Aspect["L"] = 2] = "L";
Aspect[Aspect["H"] = 3] = "H";
Aspect[Aspect["U"] = 4] = "U";
Aspect[Aspect["HU"] = 5] = "HU";
Aspect[Aspect["B"] = 6] = "B";
Aspect[Aspect["A"] = 7] = "A";
})(Aspect || (Aspect = {}));
var DevicePort;
(function (DevicePort) {
DevicePort[DevicePort["A"] = 0] = "A";
DevicePort[DevicePort["B"] = 1] = "B";
DevicePort[DevicePort["C"] = 2] = "C";
})(DevicePort || (DevicePort = {}));
var SignalColorEnum;
(function (SignalColorEnum) {
SignalColorEnum["humanControlColor"] = "0xffff00";
SignalColorEnum["fleetModeColor"] = "0x00ff00";
SignalColorEnum["blockedColor"] = "0XFF0000";
SignalColorEnum["defaultCodeColor"] = "0XFFFFFF";
SignalColorEnum["lampPostColor"] = "0xFFFFFF";
SignalColorEnum["redLamp"] = "0XFF0000";
SignalColorEnum["greenLamp"] = "0X00FF00";
SignalColorEnum["yellowLamp"] = "0XFFFF00";
SignalColorEnum["whiteLamp"] = "0XFFFFFF";
SignalColorEnum["blueLamp"] = "0X0033FF";
SignalColorEnum["closeLamp"] = "0X000000";
SignalColorEnum["logicModeColor"] = "0x000000";
SignalColorEnum["lampLineColor"] = "0x3149c3";
})(SignalColorEnum || (SignalColorEnum = {}));
const signalConsts = {
fleetModeLength: 24,
fleetModeRadius: 8,
fleetModeLineWidth: 6,
humanControlRadius: 8,
codeOffset: 20,
codeFontSize: 11,
blockedLineWidth: 1,
verticalLampPostLength: 16,
levelLampPostLength: 4,
postLineWidth: 3,
lampRadius: 8,
logicModeLineWidth: 2,
logicModeDistance: 5,
lampLineWidth: 1,
};
class Signal extends JlGraphic {
static Type = 'signal';
signalCode = new SignalCode();
humanControl = new Graphics();
fleetMode = new Graphics();
lampMainBody = new LampMainBody();
blockedMode = new Graphics();
constructor() {
super(Signal.Type);
// this.addChild(this.humanControl);
// this.addChild(this.fleetMode);
this.addChild(this.lampMainBody);
this.addChild(this.signalCode);
}
get datas() {
return this.getDatas();
}
get mirror() {
return this.datas.mirror;
}
set mirror(v) {
const old = this.datas.clone();
old.mirror = v;
this.updateData(old);
}
get states() {
return this.getStates();
}
paint() {
const mirror = this.datas.mirror;
this.lampMainBody.paint(this.datas.mt, mirror);
this.signalCode.paint(this.datas);
const codeTransform = this.datas?.childTransforms?.find((item) => item.name === 'signalCode');
if (codeTransform) {
const position = codeTransform?.transform.position;
const rotation = codeTransform?.transform?.rotation;
this.signalCode.position.set(position?.x, position?.y);
this.signalCode.rotation = rotation || 0;
}
else {
this.signalCode.position.set(0, signalConsts.codeOffset);
}
}
doRepaint() {
this.paint();
}
chagneState() {
switch (this.states.aspect) {
case Aspect.OFF:
this.setStateOff();
case Aspect.H:
this.setStateH();
break;
case Aspect.L:
this.setStateL();
break;
case Aspect.U:
this.setStateU();
break;
case Aspect.HU:
this.setStateHu();
break;
case Aspect.A:
this.setStateA();
break;
case Aspect.B:
this.setStateB();
break;
}
}
/** 设置状态自动进路 */
// setStateFleetMode(): void {
// const mirror = this.datas.mirror;
// this.fleetMode.beginFill(SignalColorEnum.fleetModeColor, 1);
// let lmp = new Point(
// this.lampMainBody.width + signalConsts.fleetModeLength,
// 0
// );
// if (mirror) {
// lmp = calculateMirrorPoint(new Point(0, 0), lmp);
// }
// drawArrow(
// this.fleetMode,
// lmp.x,
// 0,
// signalConsts.fleetModeLength,
// signalConsts.fleetModeRadius,
// signalConsts.fleetModeLineWidth,
// mirror
// );
// this.fleetMode.endFill();
// }
/** 设置状态人工控 */
// setStateHumanControl(): void {
// const mirror = this.datas.mirror;
// this.humanControl.beginFill(SignalColorEnum.humanControlColor, 1);
// if (this.humanControl.drawRegularPolygon) {
// let hmp = new Point(-signalConsts.humanControlRadius, 0);
// if (mirror) {
// hmp = calculateMirrorPoint(new Point(0, 0), hmp);
// }
// this.humanControl.drawRegularPolygon(
// hmp.x,
// hmp.y,
// signalConsts.humanControlRadius,
// 3,
// (Math.PI / 2) * (mirror ? -1 : 1)
// );
// }
// this.humanControl.endFill();
// }
/** 设置状态封锁 */
// setStateBlocked() {
// this.signalCode.createBlockedMode();
// }
/** 设置状态红灯 */
setStateH() {
this.lampMainBody.setStateH();
}
/** 设置状态绿灯 */
setStateL() {
this.lampMainBody.setStateL();
}
/** 设置状态黄灯 */
setStateU() {
this.lampMainBody.setStateU();
}
/** 设置状态红黄灯 */
setStateHu() {
this.lampMainBody.setStateHu();
}
/** 设置状态白灯 */
setStateA() {
this.lampMainBody.setStateA();
}
/** 设置状态蓝灯 */
setStateB() {
this.lampMainBody.setStateB();
}
/** 设置状态灯位关闭 */
setStateOff() {
this.lampMainBody.setStateOff();
}
buildRelation() {
// ....
}
loadRelations() {
if (this.datas.refDev) {
this.relationManage.addRelation(new GraphicRelationParam(this, ''), new GraphicRelationParam(this.queryStore.queryById(this.datas.refDev.id), this.datas.refDev.devicePort));
}
}
}
class SignalTemplate extends JlGraphicTemplate {
constructor(dataTemplate, stateTemplate) {
super(Signal.Type, { dataTemplate, stateTemplate });
}
new() {
const g = new Signal();
g.loadData(this.datas);
g.loadState(this.states);
return g;
}
}
export { Aspect, DevicePort, DeviceType, Direction, Model, Signal, SignalColorEnum, SignalTemplate, signalConsts };

View File

@ -0,0 +1,29 @@
import { FederatedPointerEvent, IHitArea, Point } from 'pixi.js';
import { GraphicDrawAssistant, GraphicInteractionPlugin, GraphicTransformEvent, IDrawApp, JlGraphic } from 'jl-graphic';
import { ISignalData, Signal, SignalTemplate } from './Signal';
export interface ISignalDrawOptions {
newData: () => ISignalData;
}
export declare class SignalDraw extends GraphicDrawAssistant<SignalTemplate, ISignalData> {
_signal: Signal | null;
constructor(app: IDrawApp, template: SignalTemplate);
get signal(): Signal;
onLeftUp(e: FederatedPointerEvent): void;
redraw(p: Point): void;
prepareData(data: ISignalData): boolean;
}
export declare class SignalGraphicHitArea implements IHitArea {
signal: Signal;
constructor(signal: Signal);
contains(x: number, y: number): boolean;
}
export declare class SignalInteraction extends GraphicInteractionPlugin<Signal> {
static Name: string;
constructor(app: IDrawApp);
static init(app: IDrawApp): SignalInteraction;
filter(...grahpics: JlGraphic[]): Signal[] | undefined;
bind(g: Signal): void;
unbind(g: Signal): void;
transformstart(e: GraphicTransformEvent): void;
codetransformstart(e: GraphicTransformEvent): void;
}

View File

@ -0,0 +1,140 @@
import { Point } from 'pixi.js';
import { GraphicDrawAssistant, GraphicInteractionPlugin, AbsorbableLine } from 'jl-graphic';
import { Signal } from './Signal.js';
class SignalDraw extends GraphicDrawAssistant {
_signal = null;
constructor(app, template) {
super(app, template, 'svguse: ../../drawIcon.svg#icon-signal', '信号机Signal');
SignalInteraction.init(app);
}
get signal() {
if (!this._signal) {
this._signal = this.graphicTemplate.new();
this._signal.loadData(this.graphicTemplate.datas);
this.container.addChild(this._signal);
}
return this._signal;
}
onLeftUp(e) {
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
this.createAndStore(true);
}
redraw(p) {
this.signal.paint();
this.container.position.set(p.x, p.y);
}
prepareData(data) {
data.transform = this.container.saveTransform();
return true;
}
}
class SignalGraphicHitArea {
signal;
constructor(signal) {
this.signal = signal;
}
contains(x, y) {
const bound = this.signal.getLocalBounds();
const maxX = bound.x + bound.width;
const minX = bound.x;
const maxY = bound.y + bound.height;
const minY = bound.y;
return maxX >= x && x >= minX && maxY >= y && y >= minY;
}
}
/**
* 构建吸附线
* @param signal
*/
function buildAbsorbablePositions(signal) {
const aps = [];
const signals = signal.queryStore.queryByType(Signal.Type);
const canvas = signal.getCanvas();
signals.forEach((item) => {
if (item.id === signal.id) {
return;
}
const ala = new AbsorbableLine(new Point(item.x, 0), new Point(item.x, canvas.height));
const alb = new AbsorbableLine(new Point(0, item.y), new Point(canvas.width, item.y));
aps.push(ala);
aps.push(alb);
});
return aps;
}
/**
* 信号机名称构建吸附线
* @param signal
*/
function buildCodeAbsorbablePositions(signal) {
const aps = [];
const signals = signal.queryStore.queryByType(Signal.Type);
const canvas = signal.getCanvas();
signals.forEach((item) => {
if (item.id === signal.id) {
return;
}
const codePoint = item.signalCode.getPositionOnCanvas();
const ala = new AbsorbableLine(new Point(codePoint.x, 0), new Point(codePoint.x, canvas.height));
const alb = new AbsorbableLine(new Point(0, codePoint.y), new Point(canvas.width, codePoint.y));
aps.push(ala);
aps.push(alb);
});
return aps;
}
class SignalInteraction extends GraphicInteractionPlugin {
static Name = 'signal_transform';
constructor(app) {
super(SignalInteraction.Name, app);
}
static init(app) {
return new SignalInteraction(app);
}
filter(...grahpics) {
return grahpics
.filter((g) => g.type === Signal.Type)
.map((g) => g);
}
bind(g) {
g.eventMode = 'static';
g.cursor = 'pointer';
g.scalable = true;
g.rotatable = true;
g.lampMainBody.hitArea = new SignalGraphicHitArea(g);
g.on('transformstart', this.transformstart, this);
g.signalCode.on('transformstart', this.codetransformstart, this);
g.signalCode.draggable = true;
g.signalCode.selectable = true;
g.signalCode.rotatable = true;
g.signalCode.transformSave = true;
g.signalCode.eventMode = 'static';
}
unbind(g) {
g.eventMode = 'none';
g.scalable = false;
g.rotatable = false;
g.off('transformstart', this.transformstart, this);
g.signalCode.off('transformstart', this.codetransformstart, this);
g.signalCode.draggable = false;
g.signalCode.selectable = false;
g.signalCode.rotatable = false;
g.signalCode.transformSave = false;
g.signalCode.eventMode = 'none';
}
transformstart(e) {
const target = e.target;
const signal = target.getGraphic();
signal.getGraphicApp().setOptions({
absorbablePositions: buildAbsorbablePositions(signal),
});
}
codetransformstart(e) {
const target = e.target;
const signal = target.getGraphic();
signal.getGraphicApp().setOptions({
absorbablePositions: buildCodeAbsorbablePositions(signal),
});
}
}
export { SignalDraw, SignalGraphicHitArea, SignalInteraction };

View File

@ -0,0 +1,12 @@
import { Graphics } from 'pixi.js';
/**
*
* @param polygon
* @param x x坐标
* @param y y坐标
* @param length
* @param radius
* @param lineWidth 线
* @param mirror ()
*/
export declare function drawArrow(polygon: Graphics, x: number, y: number, length: number, radius: number, lineWidth: number, mirror: boolean): void;

View File

@ -0,0 +1,50 @@
import { calculateMirrorPoint } from 'jl-graphic';
/**
*
* @param polygon
* @param x 箭头顶点x坐标
* @param y 箭头顶点y坐标
* @param length 箭头长度
* @param radius 箭头三角半径
* @param lineWidth 箭头线宽
* @param mirror 是否镜像翻转 (基于箭头顶点)
*/
function drawArrow(polygon, x, y, length, radius, lineWidth, mirror) {
const trianglAcme = { x, y };
let triangleP1 = {
x: x - radius - Math.sin(Math.PI / 6),
y: y + Math.cos(Math.PI / 6) * radius,
};
let triangleP2 = {
x: x - radius - Math.sin(Math.PI / 6),
y: y - Math.cos(Math.PI / 6) * radius,
};
let lineP1 = {
x: x - radius - Math.sin(Math.PI / 6),
y: y + lineWidth / 2,
};
let lineP2 = {
x: x - length,
y: y + lineWidth / 2,
};
let lineP3 = {
x: x - length,
y: y - lineWidth / 2,
};
let lineP4 = {
x: x - radius - Math.sin(Math.PI / 6),
y: y - lineWidth / 2,
};
if (mirror) {
triangleP1 = calculateMirrorPoint(trianglAcme, triangleP1);
triangleP2 = calculateMirrorPoint(trianglAcme, triangleP2);
lineP1 = calculateMirrorPoint(trianglAcme, lineP1);
lineP2 = calculateMirrorPoint(trianglAcme, lineP2);
lineP3 = calculateMirrorPoint(trianglAcme, lineP3);
lineP4 = calculateMirrorPoint(trianglAcme, lineP4);
}
polygon.drawPolygon(trianglAcme.x, trianglAcme.y, triangleP1.x, triangleP1.y, lineP1.x, lineP1.y, lineP2.x, lineP2.y, lineP3.x, lineP3.y, lineP4.x, lineP4.y, triangleP2.x, triangleP2.y);
}
export { drawArrow };

15
components/Signal/common/Lamp.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
import { Container } from '@pixi/display';
import { Graphics } from 'pixi.js';
export declare class Lamp extends Container {
circleLamp: Graphics;
logicMode: Graphics;
radiusX: number;
radiusY: number;
constructor(hasLogic: boolean);
paint(radiusX: number, radiusY: number): void;
createLampBad(): void;
createLamp(color?: string): void;
createLogicMode(): void;
logicModeClear(): void;
lampClear(): void;
}

View File

@ -0,0 +1,78 @@
import { Container } from '@pixi/display';
import { Graphics } from 'pixi.js';
import { signalConsts, SignalColorEnum } from '../bjRtss/Signal.js';
const lampConsts = {
lampLineWidth: 1,
lampBadColor: '0xFF0000',
badStart: 10,
badEnd: 15,
};
class Lamp extends Container {
circleLamp = new Graphics();
logicMode = new Graphics();
radiusX = 0;
radiusY = 0;
constructor(hasLogic) {
super();
this.addChild(this.circleLamp);
if (hasLogic) {
this.addChild(this.logicMode);
}
}
paint(radiusX, radiusY) {
this.radiusX = radiusX;
this.radiusY = radiusY;
this.createLamp();
}
createLampBad() {
this.circleLamp.lineStyle(lampConsts.lampLineWidth, lampConsts.lampBadColor);
this.circleLamp.moveTo(this.radiusX + lampConsts.badStart, this.radiusY);
this.circleLamp.lineTo(this.radiusX + lampConsts.badEnd, this.radiusY);
this.circleLamp.moveTo(this.radiusX - lampConsts.badStart, this.radiusY);
this.circleLamp.lineTo(this.radiusX - lampConsts.badEnd, this.radiusY);
this.circleLamp.moveTo(this.radiusX, this.radiusY + lampConsts.badStart);
this.circleLamp.lineTo(this.radiusX, this.radiusY + lampConsts.badEnd);
this.circleLamp.moveTo(this.radiusX, this.radiusY - lampConsts.badStart);
this.circleLamp.lineTo(this.radiusX, this.radiusY - lampConsts.badEnd);
const xieStart = Math.sin(Math.PI / 4) * lampConsts.badStart;
const xieEnd = Math.sin(Math.PI / 4) * lampConsts.badEnd;
this.circleLamp.moveTo(this.radiusX + xieStart, this.radiusY + xieStart);
this.circleLamp.lineTo(this.radiusX + xieEnd, this.radiusY + xieEnd);
this.circleLamp.moveTo(this.radiusX + xieStart, this.radiusY - xieStart);
this.circleLamp.lineTo(this.radiusX + xieEnd, this.radiusY - xieEnd);
this.circleLamp.moveTo(this.radiusX - xieStart, this.radiusY - xieStart);
this.circleLamp.lineTo(this.radiusX - xieEnd, this.radiusY - xieEnd);
this.circleLamp.moveTo(this.radiusX - xieStart, this.radiusY + xieStart);
this.circleLamp.lineTo(this.radiusX - xieEnd, this.radiusY + xieEnd);
}
createLamp(color) {
this.circleLamp.clear();
this.circleLamp.lineStyle(signalConsts.lampLineWidth, SignalColorEnum.lampLineColor);
if (!color) {
this.circleLamp.beginFill('0XFFFFFF', 0);
}
else {
this.circleLamp.beginFill(color, 1);
}
this.circleLamp.drawCircle(this.radiusX, this.radiusY, signalConsts.lampRadius);
this.circleLamp.endFill();
}
createLogicMode() {
this.logicMode
.clear()
.lineStyle(signalConsts.logicModeLineWidth, SignalColorEnum.logicModeColor)
.moveTo(this.radiusX - signalConsts.logicModeDistance, this.radiusY + signalConsts.logicModeDistance)
.lineTo(this.radiusX + signalConsts.logicModeDistance, this.radiusY - signalConsts.logicModeDistance)
.moveTo(this.radiusX - signalConsts.logicModeDistance, this.radiusY - signalConsts.logicModeDistance)
.lineTo(this.radiusX + signalConsts.logicModeDistance, this.radiusY + signalConsts.logicModeDistance);
}
logicModeClear() {
this.logicMode.clear();
}
lampClear() {
this.circleLamp.clear();
}
}
export { Lamp };

View File

@ -0,0 +1,11 @@
import { Container, Graphics } from 'pixi.js';
import { VectorText } from 'jl-graphic';
import { ISignalData } from '../bjRtss/Signal';
export declare class SignalCode extends Container {
blockedMode: Graphics;
codeGraph: VectorText;
name: string;
constructor();
paint(datas: ISignalData): void;
createBlockedMode(): void;
}

View File

@ -0,0 +1,31 @@
import { Container, Graphics, Point } from 'pixi.js';
import { VectorText } from 'jl-graphic';
import { SignalColorEnum, signalConsts } from '../bjRtss/Signal.js';
class SignalCode extends Container {
blockedMode = new Graphics();
codeGraph = new VectorText('');
name = 'signalCode';
constructor() {
super();
this.addChild(this.blockedMode);
this.addChild(this.codeGraph);
}
paint(datas) {
this.codeGraph.text = datas?.code || '信号机编号';
this.codeGraph.style.fill = SignalColorEnum.defaultCodeColor;
this.codeGraph.setVectorFontSize(signalConsts.codeFontSize);
this.codeGraph.anchor.set(0.5);
this.codeGraph.position.set(0, 0);
this.blockedMode.clear();
}
createBlockedMode() {
const codeRect = this.codeGraph.getBounds();
const rectP = this.screenToLocalPoint(new Point(codeRect.x, codeRect.y));
this.blockedMode.clear();
this.blockedMode.lineStyle(signalConsts.blockedLineWidth, SignalColorEnum.blockedColor);
this.blockedMode.drawRect(rectP.x, rectP.y, codeRect.width, codeRect.height);
}
}
export { SignalCode };

25
components/Signal/th/LampMainBody.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
import { Graphics, Container } from 'pixi.js';
import { GraphicAnimation } from 'jl-graphic';
import { Lamp } from '../common/Lamp';
import { Model } from './Signal';
export declare class LampMainBody extends Container {
static Type: string;
lampNum: number;
lampPost: Graphics;
lamps: Lamp[];
mirror: boolean;
deltaTime: number;
constructor();
paint(mt: Model, mirror: boolean): void;
setStateBlueShow(): void;
setStateLampBad(): void;
setStateLogic(): void;
setStateH(): void;
setStateL(): void;
setStateU(): void;
setStateHu(): void;
setStateA(): void;
setStateB(): void;
setStateOff(): void;
createFlashAnmiation(name: string, color: string, lampIndex: number): GraphicAnimation;
}

View File

@ -0,0 +1,128 @@
import { Container, Graphics, Point } from 'pixi.js';
import { calculateMirrorPoint, GraphicAnimation } from 'jl-graphic';
import { Lamp } from '../common/Lamp.js';
import { Model, signalConsts, SignalColorEnum } from './Signal.js';
class LampMainBody extends Container {
static Type = 'LampMainBody';
lampNum = 1;
lampPost = new Graphics();
lamps = [];
mirror = false;
deltaTime = 0;
constructor() {
super();
}
paint(mt, mirror) {
this.mirror = mirror;
if (mt === Model.HL ||
mt === Model.AB) {
this.lampNum = 2;
}
else {
this.lampNum = 3;
}
this.removeChildren(0);
this.lampPost = new Graphics();
let lpp = new Point(signalConsts.levelLampPostLength, 0);
if (mirror) {
lpp = calculateMirrorPoint(new Point(0, 0), lpp);
}
this.lampPost
.lineStyle(signalConsts.postLineWidth, SignalColorEnum.lampPostColor)
.moveTo(0, -signalConsts.verticalLampPostLength / 2)
.lineTo(0, signalConsts.verticalLampPostLength / 2)
.moveTo(0, 0)
.lineTo(lpp.x, lpp.y);
this.addChild(this.lampPost);
this.lamps = [];
for (let i = 0; i < this.lampNum; i++) {
const lamp = new Lamp(true);
this.addChild(lamp);
const radiusX = (1 + i * 2) * signalConsts.lampRadius +
signalConsts.levelLampPostLength;
let lrp = new Point(radiusX, 0);
if (mirror) {
lrp = calculateMirrorPoint(new Point(0, 0), lrp);
}
lamp.paint(lrp.x, lrp.y);
this.lamps.push(lamp);
}
}
setStateBlueShow() {
this.lamps.forEach(lamp => {
lamp.createLamp(SignalColorEnum.blueLamp);
});
}
setStateLampBad() {
this.lamps.forEach(lamp => {
lamp.createLampBad();
});
}
setStateLogic() {
this.lamps.forEach(lamp => {
lamp.createLogicMode();
});
}
setStateH() {
this.lamps[0].createLamp(SignalColorEnum.redLamp);
this.lamps.forEach((lamp, index) => {
if (index !== 0) {
lamp.createLamp(SignalColorEnum.closeLamp);
}
});
}
setStateL() {
this.lamps[1].createLamp(SignalColorEnum.greenLamp);
this.lamps.forEach((lamp, index) => {
if (index !== 1) {
lamp.createLamp(SignalColorEnum.closeLamp);
}
});
}
setStateU() {
this.lamps[2].createLamp(SignalColorEnum.yellowLamp);
this.lamps.forEach((lamp, index) => {
if (index !== 2) {
lamp.createLamp(SignalColorEnum.closeLamp);
}
});
}
setStateHu() {
this.lamps[0].createLamp(SignalColorEnum.redLamp);
this.lamps[1].createLamp(SignalColorEnum.closeLamp);
this.lamps[2].createLamp(SignalColorEnum.yellowLamp);
}
setStateA() {
this.lamps[0].createLamp(SignalColorEnum.blueLamp);
this.lamps[1].createLamp(SignalColorEnum.closeLamp);
}
setStateB() {
this.lamps[0].createLamp(SignalColorEnum.whiteLamp);
this.lamps[1].createLamp(SignalColorEnum.closeLamp);
}
setStateOff() {
this.lamps.forEach((lamp) => lamp.createLamp(SignalColorEnum.closeLamp));
}
createFlashAnmiation(name, color, lampIndex) {
const bgColor = '0X000000';
const flashAnmiation = GraphicAnimation.init({
name: name,
run: (dt) => {
this.deltaTime += dt;
if (this.deltaTime > 60) {
this.deltaTime = 0;
this.lamps[lampIndex].createLamp(color);
}
else if (this.deltaTime > 30) {
this.lamps.forEach((lamp) => {
lamp.createLamp(bgColor);
});
}
},
});
return flashAnmiation;
}
}
export { LampMainBody };

112
components/Signal/th/Signal.d.ts vendored Normal file
View File

@ -0,0 +1,112 @@
import { GraphicData, JlGraphic } from 'jl-graphic';
import { Graphics } from 'pixi.js';
import { SignalCode } from '../common/SignalCode';
import { LampMainBody } from './LampMainBody';
/** 信号机类型 */
export declare enum Model {
HL = 0,// 红绿灯
HLU_FU = 1,// 红绿黄,封黄灯,无引导
HLU_DU_YY = 2,// 红绿黄,不封灯,有单黄,带引导
HLU_YY = 3,// 红绿黄,不封灯,无单黄,带引导
HLU_FL_DU_YY = 4,// 红绿黄,封绿灯,有单黄,带引导
HLU_DU = 5,// 红绿黄,不封灯,有单黄,无引导
AB = 6,// 蓝白
HBU_DU = 7
}
/** 信号机颜色 */
export declare enum SignalColorEnum {
humanControlColor = "0xffff00",
fleetModeColor = "0x00ff00",
blockedColor = "0XFF0000",
defaultCodeColor = "0XFFFFFF",
lampPostColor = "0xFFFFFF",
redLamp = "0XFF0000",
greenLamp = "0X00FF00",
yellowLamp = "0XFFFF00",
whiteLamp = "0XFFFFFF",
blueLamp = "0X0033FF",
closeLamp = "0X000000",
logicModeColor = "0x000000",
lampLineColor = "0x3149c3"
}
/** 信号机常量 */
export declare const signalConsts: {
fleetModeLength: number;
fleetModeRadius: number;
fleetModeLineWidth: number;
humanControlRadius: number;
codeOffset: number;
codeFontSize: number;
blockedLineWidth: number;
verticalLampPostLength: number;
levelLampPostLength: number;
postLineWidth: number;
lampRadius: number;
logicModeLineWidth: number;
logicModeDistance: number;
lampLineWidth: number;
};
export interface ISignalData extends GraphicData {
code: string;
mirror: boolean;
mt: Model;
}
export declare class Signal extends JlGraphic {
static Type: string;
datas: ISignalData;
signalCode: SignalCode;
humanControl: Graphics;
fleetMode: Graphics;
lampMainBody: LampMainBody;
blockedMode: Graphics;
constructor(datas: ISignalData);
doRepaint(): void;
stopAnmiation(): void;
/** 设置状态自动进路 */
setStateFleetMode(): void;
/** 设置状态人工控 */
setStateHumanControl(): void;
/** 设置状态封锁 */
setStateBlocked(): void;
/** 设置状态蓝显 */
setStateBlueShow(): void;
/** 设置状态信号机损坏 */
setStateSignalBad(): void;
/** 设置状态逻辑点灯 */
setStateLogic(): void;
/** 设置状态红灯 */
setStateH(): void;
/** 设置状态绿灯 */
setStateL(): void;
/** 设置状态黄灯 */
setStateU(): void;
/** 设置状态红黄灯 */
setStateHu(): void;
/** 设置状态白灯 */
setStateA(): void;
/** 设置状态蓝灯 */
setStateB(): void;
/** 设置状态灯位关闭 */
setStateOff(): void;
/** 设置状态红闪 */
setStateRedFlash(): void;
/** 设置状态绿闪 */
setStateGreenFlash(): void;
/** 设置状态黄闪 */
setStateYellowFlash(): void;
/** 设置状态蓝闪 */
setStateBlueFlash(): void;
/** 设置状态白闪 */
setStateWhiteFlash(): void;
}
/**
*
* @param polygon
* @param x x坐标
* @param y y坐标
* @param length
* @param radius
* @param lineWidth 线
* @param mirror ()
*/
export declare function drawArrow(polygon: Graphics, x: number, y: number, length: number, radius: number, lineWidth: number, mirror: boolean): void;

View File

@ -0,0 +1,275 @@
import { JlGraphic, calculateMirrorPoint } from 'jl-graphic';
import { Graphics, Point } from 'pixi.js';
import { SignalCode } from '../common/SignalCode.js';
import { LampMainBody } from './LampMainBody.js';
/** 信号机类型 */
var Model;
(function (Model) {
Model[Model["HL"] = 0] = "HL";
Model[Model["HLU_FU"] = 1] = "HLU_FU";
Model[Model["HLU_DU_YY"] = 2] = "HLU_DU_YY";
Model[Model["HLU_YY"] = 3] = "HLU_YY";
Model[Model["HLU_FL_DU_YY"] = 4] = "HLU_FL_DU_YY";
Model[Model["HLU_DU"] = 5] = "HLU_DU";
Model[Model["AB"] = 6] = "AB";
Model[Model["HBU_DU"] = 7] = "HBU_DU";
})(Model || (Model = {}));
/** 信号机颜色 */
var SignalColorEnum;
(function (SignalColorEnum) {
SignalColorEnum["humanControlColor"] = "0xffff00";
SignalColorEnum["fleetModeColor"] = "0x00ff00";
SignalColorEnum["blockedColor"] = "0XFF0000";
SignalColorEnum["defaultCodeColor"] = "0XFFFFFF";
SignalColorEnum["lampPostColor"] = "0xFFFFFF";
SignalColorEnum["redLamp"] = "0XFF0000";
SignalColorEnum["greenLamp"] = "0X00FF00";
SignalColorEnum["yellowLamp"] = "0XFFFF00";
SignalColorEnum["whiteLamp"] = "0XFFFFFF";
SignalColorEnum["blueLamp"] = "0X0033FF";
SignalColorEnum["closeLamp"] = "0X000000";
SignalColorEnum["logicModeColor"] = "0x000000";
SignalColorEnum["lampLineColor"] = "0x3149c3";
})(SignalColorEnum || (SignalColorEnum = {}));
/** 信号机常量 */
const signalConsts = {
fleetModeLength: 24,
fleetModeRadius: 8,
fleetModeLineWidth: 6,
humanControlRadius: 8,
codeOffset: 20,
codeFontSize: 11,
blockedLineWidth: 1,
verticalLampPostLength: 16,
levelLampPostLength: 4,
postLineWidth: 3,
lampRadius: 8,
logicModeLineWidth: 2,
logicModeDistance: 5,
lampLineWidth: 1,
};
/** 动画 */
const anmiationNameConst = {
signaRedFlash: 'signal_red_flash',
signalGreenFlash: 'signal_green_flash',
signalYellowFlash: 'signal_yellow_flash',
signalWhiteFlash: 'signal_white_flash',
signalBlueFlash: 'signal_blue_flash',
};
class Signal extends JlGraphic {
static Type = 'signal';
datas;
signalCode = new SignalCode();
humanControl = new Graphics();
fleetMode = new Graphics();
lampMainBody = new LampMainBody();
blockedMode = new Graphics();
constructor(datas) {
super(Signal.Type);
this.datas = datas;
this.addChild(this.humanControl);
this.addChild(this.fleetMode);
this.addChild(this.lampMainBody);
this.addChild(this.signalCode);
this.signalCode.name = 'signalCode';
}
doRepaint() {
const mirror = this.datas.mirror;
this.lampMainBody.paint(this.datas.mt, mirror);
this.signalCode.paint(this.datas);
const codeTransform = this.datas?.childTransforms?.find((item) => item.name === 'signalCode');
if (codeTransform) {
const position = codeTransform?.transform.position;
const rotation = codeTransform?.transform?.rotation;
this.signalCode.position.set(position?.x, position?.y);
this.signalCode.rotation = rotation || 0;
}
else {
this.signalCode.position.set(0, signalConsts.codeOffset);
}
}
stopAnmiation() {
const redFlashA = this.animation(anmiationNameConst.signaRedFlash);
const greenFlashA = this.animation(anmiationNameConst.signalGreenFlash);
const blueFlashA = this.animation(anmiationNameConst.signalBlueFlash);
const yellowFlashA = this.animation(anmiationNameConst.signalYellowFlash);
const whiteFlashA = this.animation(anmiationNameConst.signalWhiteFlash);
if (redFlashA) {
redFlashA.pause();
}
if (greenFlashA) {
greenFlashA.pause();
}
if (blueFlashA) {
blueFlashA.pause();
}
if (yellowFlashA) {
yellowFlashA.pause();
}
if (whiteFlashA) {
whiteFlashA.pause();
}
}
/** 设置状态自动进路 */
setStateFleetMode() {
const mirror = this.datas.mirror;
this.fleetMode.beginFill(SignalColorEnum.fleetModeColor, 1);
let lmp = new Point(this.lampMainBody.width + signalConsts.fleetModeLength, 0);
if (mirror) {
lmp = calculateMirrorPoint(new Point(0, 0), lmp);
}
drawArrow(this.fleetMode, lmp.x, 0, signalConsts.fleetModeLength, signalConsts.fleetModeRadius, signalConsts.fleetModeLineWidth, mirror);
this.fleetMode.endFill();
}
/** 设置状态人工控 */
setStateHumanControl() {
const mirror = this.datas.mirror;
this.humanControl.beginFill(SignalColorEnum.humanControlColor, 1);
if (this.humanControl.drawRegularPolygon) {
let hmp = new Point(-signalConsts.humanControlRadius, 0);
if (mirror) {
hmp = calculateMirrorPoint(new Point(0, 0), hmp);
}
this.humanControl.drawRegularPolygon(hmp.x, hmp.y, signalConsts.humanControlRadius, 3, (Math.PI / 2) * (mirror ? -1 : 1));
}
this.humanControl.endFill();
}
/** 设置状态封锁 */
setStateBlocked() {
this.signalCode.createBlockedMode();
}
/** 设置状态蓝显 */
setStateBlueShow() {
this.lampMainBody.setStateBlueShow();
}
/** 设置状态信号机损坏 */
setStateSignalBad() {
this.lampMainBody.setStateLampBad();
}
/** 设置状态逻辑点灯 */
setStateLogic() {
this.lampMainBody.setStateLogic();
}
/** 设置状态红灯 */
setStateH() {
this.lampMainBody.setStateH();
}
/** 设置状态绿灯 */
setStateL() {
this.lampMainBody.setStateL();
}
/** 设置状态黄灯 */
setStateU() {
this.lampMainBody.setStateU();
}
/** 设置状态红黄灯 */
setStateHu() {
this.lampMainBody.setStateHu();
}
/** 设置状态白灯 */
setStateA() {
this.lampMainBody.setStateA();
}
/** 设置状态蓝灯 */
setStateB() {
this.lampMainBody.setStateB();
}
/** 设置状态灯位关闭 */
setStateOff() {
this.lampMainBody.setStateOff();
}
/** 设置状态红闪 */
setStateRedFlash() {
let redFlashA = this.animation(anmiationNameConst.signaRedFlash);
if (!redFlashA) {
redFlashA = this.lampMainBody.createFlashAnmiation(anmiationNameConst.signaRedFlash, SignalColorEnum.redLamp, 0);
}
this.addAnimation(redFlashA);
redFlashA.resume();
}
/** 设置状态绿闪 */
setStateGreenFlash() {
let greenFlashA = this.animation(anmiationNameConst.signalGreenFlash);
if (!greenFlashA) {
greenFlashA = this.lampMainBody.createFlashAnmiation(anmiationNameConst.signalGreenFlash, SignalColorEnum.greenLamp, 1);
}
this.addAnimation(greenFlashA);
greenFlashA.resume();
}
/** 设置状态黄闪 */
setStateYellowFlash() {
let yellowFlashA = this.animation(anmiationNameConst.signalYellowFlash);
if (!yellowFlashA) {
yellowFlashA = this.lampMainBody.createFlashAnmiation(anmiationNameConst.signalYellowFlash, SignalColorEnum.yellowLamp, 2);
}
this.addAnimation(yellowFlashA);
yellowFlashA.resume();
}
/** 设置状态蓝闪 */
setStateBlueFlash() {
let blueFlashA = this.animation(anmiationNameConst.signalBlueFlash);
if (!blueFlashA) {
blueFlashA = this.lampMainBody.createFlashAnmiation(anmiationNameConst.signalBlueFlash, SignalColorEnum.blueLamp, 0);
}
this.addAnimation(blueFlashA);
blueFlashA.resume();
}
/** 设置状态白闪 */
setStateWhiteFlash() {
let whiteFlashA = this.animation(anmiationNameConst.signalWhiteFlash);
if (!whiteFlashA) {
whiteFlashA = this.lampMainBody.createFlashAnmiation(anmiationNameConst.signalWhiteFlash, SignalColorEnum.whiteLamp, 0);
}
this.addAnimation(whiteFlashA);
whiteFlashA.resume();
}
}
/**
*
* @param polygon
* @param x 箭头顶点x坐标
* @param y 箭头顶点y坐标
* @param length 箭头长度
* @param radius 箭头三角半径
* @param lineWidth 箭头线宽
* @param mirror 是否镜像翻转 (基于箭头顶点)
*/
function drawArrow(polygon, x, y, length, radius, lineWidth, mirror) {
const trianglAcme = { x, y };
let triangleP1 = {
x: x - radius - Math.sin(Math.PI / 6),
y: y + Math.cos(Math.PI / 6) * radius,
};
let triangleP2 = {
x: x - radius - Math.sin(Math.PI / 6),
y: y - Math.cos(Math.PI / 6) * radius,
};
let lineP1 = {
x: x - radius - Math.sin(Math.PI / 6),
y: y + lineWidth / 2,
};
let lineP2 = {
x: x - length,
y: y + lineWidth / 2,
};
let lineP3 = {
x: x - length,
y: y - lineWidth / 2,
};
let lineP4 = {
x: x - radius - Math.sin(Math.PI / 6),
y: y - lineWidth / 2,
};
if (mirror) {
triangleP1 = calculateMirrorPoint(trianglAcme, triangleP1);
triangleP2 = calculateMirrorPoint(trianglAcme, triangleP2);
lineP1 = calculateMirrorPoint(trianglAcme, lineP1);
lineP2 = calculateMirrorPoint(trianglAcme, lineP2);
lineP3 = calculateMirrorPoint(trianglAcme, lineP3);
lineP4 = calculateMirrorPoint(trianglAcme, lineP4);
}
polygon.drawPolygon(trianglAcme.x, trianglAcme.y, triangleP1.x, triangleP1.y, lineP1.x, lineP1.y, lineP2.x, lineP2.y, lineP3.x, lineP3.y, lineP4.x, lineP4.y, triangleP2.x, triangleP2.y);
}
export { Model, Signal, SignalColorEnum, drawArrow, signalConsts };

16
components/SpksSwitch/SpksSwitch.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
import { Graphics } from 'pixi.js';
import { GraphicData, JlGraphic, VectorText } from 'jl-graphic';
export interface ISpksSwitchData extends GraphicData {
code: string;
flip: boolean;
}
export declare class SpksSwitch extends JlGraphic {
static Type: string;
datas: ISpksSwitchData;
codeGraph: VectorText;
rectBody: Graphics;
lineBody: Graphics;
textGraph: VectorText;
constructor(datas: ISpksSwitchData);
doRepaint(): void;
}

View File

@ -0,0 +1,65 @@
import { Graphics } from 'pixi.js';
import { JlGraphic, VectorText } from 'jl-graphic';
const spksSwitchConsts = {
codeFontSize: 12,
codeColor: 0xffffff,
bodyLineColor: 0xffffff,
bodyLineWidth: 4,
bodyRectLineColor: 0xffffff,
bodyRectLineWidth: 2,
bodyRectWidth: 20,
bodyRectHeight: 20,
bodyColor: 0x000000,
};
class SpksSwitch extends JlGraphic {
static Type = 'spksSwitch';
datas;
codeGraph = new VectorText('');
rectBody = new Graphics();
lineBody = new Graphics();
textGraph = new VectorText('S');
constructor(datas) {
super(SpksSwitch.Type);
this.datas = datas;
this.addChild(this.codeGraph);
this.addChild(this.rectBody);
this.addChild(this.lineBody);
this.addChild(this.textGraph);
this.textGraph.name = 'spks_switch_code';
}
doRepaint() {
const codeGraph = this.codeGraph;
codeGraph.text = this.datas.code;
codeGraph.style.fill = spksSwitchConsts.codeColor;
codeGraph.setVectorFontSize(spksSwitchConsts.codeFontSize);
const codeTransform = this.datas?.childTransforms?.find((item) => item.name === 'spks_switch_code');
if (codeTransform) {
const position = codeTransform?.transform.position;
const rotation = codeTransform?.transform?.rotation;
codeGraph.position.set(position?.x, position?.y);
codeGraph.rotation = rotation || 0;
}
else {
codeGraph.position.set(20, 0);
}
codeGraph.anchor.set(0.5);
this.textGraph.style.fill = spksSwitchConsts.codeColor;
this.textGraph.setVectorFontSize(spksSwitchConsts.codeFontSize);
this.textGraph.anchor.set(0.5);
this.rectBody.clear();
this.rectBody.beginFill(spksSwitchConsts.bodyColor, 0);
this.rectBody.lineStyle(spksSwitchConsts.bodyRectLineWidth, spksSwitchConsts.bodyRectLineColor);
this.rectBody.drawRect(-spksSwitchConsts.bodyRectWidth / 2, -spksSwitchConsts.bodyRectHeight / 2, spksSwitchConsts.bodyRectWidth, spksSwitchConsts.bodyRectHeight);
this.rectBody.endFill();
this.lineBody.clear();
const lineY = this.datas.flip
? spksSwitchConsts.bodyRectHeight / 2
: -spksSwitchConsts.bodyRectHeight / 2;
this.lineBody.lineStyle(spksSwitchConsts.bodyLineWidth, spksSwitchConsts.bodyLineColor);
this.lineBody.moveTo(-spksSwitchConsts.bodyRectWidth / 2, lineY);
this.lineBody.lineTo(spksSwitchConsts.bodyRectWidth / 2, lineY);
}
}
export { SpksSwitch };

30
components/Station/JlStation.d.ts vendored Normal file
View File

@ -0,0 +1,30 @@
import { Container, Point } from 'pixi.js';
import { JlGraphic, VectorText } from 'jl-graphic';
import { ConstrolConstsConfig, ConstrolItemConfig, IStationData, StationConstsConfig } from './StationConfig';
import { CategoryType } from '../Platform/PlatformConfig';
declare class constrolGraphic extends Container {
categoryType: CategoryType;
constrolConfig?: ConstrolItemConfig[];
stateArrowFillColor?: string;
constructor(categoryType: CategoryType);
draw(stationConsts: StationConstsConfig): void;
drawCircleCode(constrolConsts: ConstrolConstsConfig, code: string, circleFillColor: string, codeGraphFillColor: string, pos: {
circlePs: Point;
codeGraphPs: Point;
}): void;
clear(): void;
}
export declare class JlStation extends JlGraphic {
static Type: string;
private categoryType;
stationConsts: StationConstsConfig;
codeGraph: VectorText;
kilometerGraph: VectorText;
controlGraphic?: constrolGraphic;
_ipRtuStusDown: boolean;
constructor(categoryType: CategoryType);
get datas(): IStationData;
get code(): string;
doRepaint(): void;
}
export {};

View File

@ -0,0 +1,150 @@
import { Container, Point, Graphics, Color } from 'pixi.js';
import { JlGraphic, VectorText } from 'jl-graphic';
import { stationConstsMap } from './StationConfig.js';
import { CategoryType } from '../Platform/PlatformConfig.js';
class constrolGraphic extends Container {
categoryType;
constrolConfig;
stateArrowFillColor;
constructor(categoryType) {
super();
this.categoryType = categoryType;
}
draw(stationConsts) {
const constrolConsts = stationConsts.constrolGraphic;
const graphicsPs = [];
for (let i = 0; i < constrolConsts.constrolConfig.length; i++) {
const posX = constrolConsts.circleBetweenOffset *
(i - (constrolConsts.constrolConfig.length - 1) / 2);
graphicsPs.push({
circlePs: new Point(posX, constrolConsts.circleOffsetY),
codeGraphPs: new Point(posX, constrolConsts.codeOffsetY),
});
}
const constrolConfig = this.constrolConfig || constrolConsts.constrolConfig;
constrolConfig.forEach((g, i) => {
this.drawCircleCode(constrolConsts, g.codeText, g.circleFillColor, g.codeGraphFillColor, graphicsPs[i]);
});
if (constrolConsts.inArrowFillColor) {
const points = [0, 0, 2, 2, 2, 1, 14, 1, 14, -1, 2, -1, 2, -2];
const arrow = new Graphics();
arrow
.clear()
.lineStyle(constrolConsts.borderWidth, new Color('0xFFFFFF'))
.beginFill('0xFFFFFF')
.drawPolygon(points)
.endFill();
arrow.scale.set(1.1, 1.1);
arrow.position.set(-7, constrolConsts.circleOffsetY);
this.addChild(arrow);
const inArrow = new Graphics();
const fillColor = this.stateArrowFillColor || constrolConsts.inArrowFillColor;
inArrow.beginFill(fillColor).drawPolygon(points).endFill();
inArrow.position.set(-6.5, constrolConsts.circleOffsetY);
this.addChild(inArrow);
}
}
drawCircleCode(constrolConsts, code, circleFillColor, codeGraphFillColor, pos) {
const circle = new Graphics();
const codeGraph = new VectorText();
this.addChild(circle);
this.addChild(codeGraph);
circle.tint = 0xffffff;
circle
.clear()
.lineStyle(constrolConsts.borderWidth, new Color(circleFillColor))
.beginFill(circleFillColor, 1)
.drawCircle(0, 0, constrolConsts.radius).endFill;
circle.position.copyFrom(pos.circlePs);
codeGraph.text = code;
codeGraph.style.fill = codeGraphFillColor;
codeGraph.setVectorFontSize(constrolConsts.codeControlFontSize);
codeGraph.anchor.set(0.5);
codeGraph.position.copyFrom(pos.codeGraphPs);
}
clear() {
this.children.forEach((child) => {
if (child instanceof Graphics) {
child.clear();
}
else if (child instanceof VectorText) {
child.text = '';
}
});
}
}
class JlStation extends JlGraphic {
static Type = 'station';
categoryType;
stationConsts;
codeGraph = new VectorText(''); //车站名
kilometerGraph = new VectorText(''); //公里标
controlGraphic;
_ipRtuStusDown = false;
constructor(categoryType) {
super(JlStation.Type);
this.categoryType = categoryType;
this.stationConsts = stationConstsMap.get(this.categoryType);
this.addChild(this.codeGraph);
this.addChild(this.kilometerGraph);
if (this.stationConsts.constrolGraphic) {
this.controlGraphic = new constrolGraphic(categoryType);
this.addChild(this.controlGraphic);
}
}
get datas() {
return this.getDatas();
}
get code() {
return this.datas.code;
}
doRepaint() {
const codeGraph = this.codeGraph;
const kilometerGraph = this.kilometerGraph;
const controlGraphic = this.controlGraphic;
controlGraphic?.clear();
switch (this.categoryType) {
case CategoryType.XiAn:
codeGraph.text = this.datas?.code
? `${this.datas?.name}(${this.datas?.code})`
: `${this.datas?.name}`;
break;
case CategoryType.BeiJing:
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 =
'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);
}
});
}
if (this.controlGraphic) {
this.controlGraphic.draw(this.stationConsts);
}
}
}
export { JlStation };

98
components/Station/StationConfig.d.ts vendored Normal file
View File

@ -0,0 +1,98 @@
import { GraphicData } from 'jl-graphic';
import { CategoryType } from '../Platform/PlatformConfig';
export interface StationConstsConfig {
codeColor: string;
codeFontSize: number;
kilometerCodeColor: string;
kilometerCodeFontSize: number;
kilometerCodeOffsetY: number;
constrolGraphic?: ConstrolConstsConfig;
}
export interface ConstrolConstsConfig {
radius: number;
borderWidth: number;
codeControlFontSize: number;
codeOffsetY: number;
circleOffsetY: number;
circleBetweenOffset: number;
constrolConfig: ConstrolItemConfig[];
inArrowFillColor?: string;
}
export interface ConstrolItemConfig {
codeText: string;
circleFillColor: string;
codeGraphFillColor: string;
}
export declare const BeiJingConsts: {
codeColor: string;
codeFontSize: number;
kilometerCodeColor: string;
kilometerCodeFontSize: number;
kilometerCodeOffsetY: number;
};
export declare const XiAnConsts: {
codeColor: string;
codeFontSize: number;
kilometerCodeColor: string;
kilometerCodeFontSize: number;
kilometerCodeOffsetY: number;
constrolGraphic: {
radius: number;
borderWidth: number;
codeControlFontSize: number;
codeOffsetY: number;
circleOffsetY: number;
circleBetweenOffset: number;
inArrowFillColor: string;
constrolConfig: {
codeText: string;
circleFillColor: string;
codeGraphFillColor: string;
}[];
};
};
export declare const otherConsts: {
codeColor: string;
codeFontSize: number;
kilometerCodeColor: string;
kilometerCodeFontSize: number;
kilometerCodeOffsetY: number;
constrolGraphic: {
radius: number;
borderWidth: number;
codeControlFontSize: number;
codeOffsetY: number;
circleOffsetY: number;
circleBetweenOffset: number;
constrolConfig: {
codeText: string;
circleFillColor: string;
codeGraphFillColor: string;
}[];
};
};
export declare const stationConstsMap: Map<CategoryType, StationConstsConfig>;
export interface IStationData extends GraphicData {
code: string;
kilometerSystem: KilometerSystem;
hasControl: boolean;
concentrationStations: boolean;
name: string;
manageStations: number[];
depots: boolean;
clone(): IStationData;
copyFrom(data: IStationData): void;
eq(other: IStationData): boolean;
}
export interface KilometerSystem {
get coordinateSystem(): string;
set coordinateSystem(v: string);
get kilometer(): number;
set kilometer(v: number);
get direction(): Direction;
set direction(v: Direction);
}
export declare enum Direction {
LEFT = 0,
RIGHT = 1
}

View File

@ -0,0 +1,90 @@
import { CategoryType } from '../Platform/PlatformConfig.js';
const BeiJingConsts = {
codeColor: '0xF48815',
codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF',
kilometerCodeFontSize: 8,
kilometerCodeOffsetY: -25,
};
const XiAnConsts = {
codeColor: '0xF48815',
codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF',
kilometerCodeFontSize: 8,
kilometerCodeOffsetY: -25,
constrolGraphic: {
radius: 3,
borderWidth: 1,
codeControlFontSize: 12,
codeOffsetY: 30,
circleOffsetY: 20,
circleBetweenOffset: 40,
inArrowFillColor: '0x808080',
constrolConfig: [
{
codeText: '中控',
circleFillColor: '0x08F80D',
codeGraphFillColor: '0x08F80D',
},
{
codeText: '站控',
circleFillColor: '0x808080',
codeGraphFillColor: '0xFFFFFF',
},
],
},
};
const otherConsts = {
codeColor: '0xF48815',
codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF',
kilometerCodeFontSize: 8,
kilometerCodeOffsetY: -25,
constrolGraphic: {
radius: 3,
borderWidth: 1,
codeControlFontSize: 12,
codeOffsetY: 30,
circleOffsetY: 20,
circleBetweenOffset: 40,
constrolConfig: [
{
codeText: '紧急站控',
circleFillColor: '0x808080',
codeGraphFillColor: '0xFFFFFF',
},
{
codeText: '中控',
circleFillColor: '0x08F80D',
codeGraphFillColor: '0x08F80D',
},
{
codeText: '站控',
circleFillColor: '0x808080',
codeGraphFillColor: '0xFFFFFF',
},
{
codeText: '联锁控',
circleFillColor: '0x808080',
codeGraphFillColor: '0xFFFFFF',
},
{
codeText: '按图折返',
circleFillColor: '0xFFFA0C',
codeGraphFillColor: '0xFFFA0C',
},
],
},
};
const stationConstsMap = new Map([
[CategoryType.BeiJing, BeiJingConsts],
[CategoryType.XiAn, XiAnConsts],
]);
var Direction;
(function (Direction) {
Direction[Direction["LEFT"] = 0] = "LEFT";
Direction[Direction["RIGHT"] = 1] = "RIGHT";
})(Direction || (Direction = {}));
export { BeiJingConsts, Direction, XiAnConsts, otherConsts, stationConstsMap };

66
components/Train/Train.d.ts vendored Normal file
View File

@ -0,0 +1,66 @@
import { Graphics, Container } from 'pixi.js';
import { JlGraphic, VectorText } from 'jl-graphic';
import { ITrainConstsConfig, EnumDiriveModel, EnumStatusText, UpdateTrainConsts, EnumTrainType, ITrainData } from './TrainConfig';
interface bodyWH {
width: number;
height: number;
}
declare class TrainHead extends Container {
arrow: Graphics;
pause: Graphics;
train: Train;
isStop: boolean;
arrowColor: string;
pauseColor: string;
constructor(train: Train);
clear(): void;
doRepaint(): void;
isRight(): boolean;
}
declare class TrainBody extends Container {
bodyRact: Graphics;
codeAGraph: VectorText;
codeBGraph: VectorText;
train: Train;
codeAColor: string;
codeBColor: string;
codeAText: string;
codeBText: string;
constructor(train: Train);
clear(): void;
getBodyWH(): bodyWH;
doRepaint(): void;
}
declare class StatusText extends Container {
sText: VectorText;
train: Train;
constructor(train: Train);
doRepaint(text: EnumStatusText, bodyWH: bodyWH): void;
clear(): void;
}
/**
*
*/
export declare class Train extends JlGraphic {
static Type: string;
trainHead: TrainHead;
trainbody: TrainBody;
statusTextMap: Map<EnumStatusText, StatusText>;
isRightRoTop: boolean;
constDatas: ITrainConstsConfig;
constructor(data?: UpdateTrainConsts);
get datas(): ITrainData;
doRepaint(): void;
setIsStop(v: boolean): void;
setArrowVisible(v: boolean): void;
setPauseVisible(v: boolean): void;
run(): void;
stop(): void;
setCodeAText(v: string): void;
setCodeBText(v: string): void;
setDiriveModelColor(s: EnumDiriveModel): void;
setTrainTypeColor(s: EnumTrainType): void;
showStatus(s: EnumStatusText): void;
hideStatus(s: EnumStatusText): void;
}
export {};

313
components/Train/Train.js Normal file
View File

@ -0,0 +1,313 @@
import { Container, Graphics, Point, Color } from 'pixi.js';
import { JlGraphic, calculateMirrorPoint, VectorText } from 'jl-graphic';
import { getTrainConsts, EnumDiriveModel, EnumTrainType } from './TrainConfig.js';
class TrainHead extends Container {
arrow; // 列车箭头
pause; // 列车停止
train;
isStop;
arrowColor;
pauseColor;
constructor(train) {
super();
this.arrow = new Graphics();
this.pause = new Graphics();
this.addChild(this.arrow);
this.addChild(this.pause);
this.train = train;
this.isStop = true;
this.arrowColor = this.train.constDatas.arrowDefaultColor;
this.pauseColor = this.train.constDatas.pauseDefaultColor;
}
clear() {
this.arrow.clear();
this.pause.clear();
}
doRepaint() {
this.clear();
const trainConsts = this.train.constDatas;
const bodyWH = this.train.trainbody.getBodyWH();
const marginX = trainConsts.marginX;
const pauseW = trainConsts.pauseW;
const bodyWidth = bodyWH ? bodyWH.width : trainConsts.bodyWidth;
const bodyHeight = bodyWH ? bodyWH.height : trainConsts.bodyHeight;
let pauseTW = pauseW + marginX;
if (trainConsts.arrowPauseOnlyOne) {
pauseTW = 0;
}
let arrowPoint = [
-bodyHeight * 0.4 - marginX - pauseTW - bodyWidth / 2,
0,
-marginX - pauseTW - bodyWidth / 2,
bodyHeight / 2,
-marginX - pauseTW - bodyWidth / 2,
-bodyHeight / 2,
];
let pausePoint = [
-marginX - pauseW / 2 - bodyWidth / 2,
-bodyHeight / 2,
-marginX - pauseW / 2 - bodyWidth / 2,
bodyHeight / 2,
];
// 列车是向右或者向上
if (this.isRight()) {
const aP = [];
arrowPoint.forEach((item, index) => {
if (index % 2 == 1) {
const p = new Point(arrowPoint[index - 1], item);
const newP = calculateMirrorPoint(new Point(0, 0), p);
aP.push(newP.x, newP.y);
}
});
arrowPoint = aP;
const pP = [];
pausePoint.forEach((item, index) => {
if (index % 2 == 1) {
const p = new Point(pausePoint[index - 1], item);
const newP = calculateMirrorPoint(new Point(0, 0), p);
pP.push(newP.x, newP.y);
}
});
pausePoint = pP;
}
this.pause.lineStyle(pauseW, this.pauseColor, 1);
this.pause.moveTo(pausePoint[0], pausePoint[1]);
this.pause.lineTo(pausePoint[2], pausePoint[3]);
const arrow = this.arrow;
arrow.beginFill(this.arrowColor, 1);
arrow.drawPolygon(arrowPoint);
arrow.endFill();
}
isRight() {
let d = false;
if (this.train.isRightRoTop) {
d = true;
}
return d;
}
}
class TrainBody extends Container {
bodyRact;
codeAGraph = new VectorText(''); //识别号AA
codeBGraph = new VectorText(''); //识别号BBB
train;
codeAColor;
codeBColor;
codeAText;
codeBText;
constructor(train) {
super();
this.bodyRact = new Graphics();
this.addChild(this.bodyRact);
this.addChild(this.codeAGraph);
this.addChild(this.codeBGraph);
this.train = train;
this.codeAGraph.setVectorFontSize(this.train.constDatas.codeFontSize);
this.codeBGraph.setVectorFontSize(this.train.constDatas.codeFontSize);
this.codeAColor = this.train.constDatas.codeColor;
this.codeBColor = this.train.constDatas.codeColor;
this.codeAText = '';
this.codeBText = '';
}
clear() {
this.bodyRact.clear();
}
getBodyWH() {
const bodyAWH = this.codeAGraph.getLocalBounds();
const bodyBWH = this.codeBGraph.getLocalBounds();
return {
width: bodyAWH.width + bodyBWH.width + this.train.constDatas.bodyPadding * 2,
height: bodyAWH.height + this.train.constDatas.bodyPadding * 2,
};
}
doRepaint() {
this.clear();
const trainConsts = this.train.constDatas;
const codeAGraph = this.codeAGraph;
const codeBGraph = this.codeBGraph;
codeAGraph.text = this.codeAText;
codeBGraph.text = this.codeBText;
codeAGraph.anchor.set(0.5);
codeBGraph.anchor.set(0.5);
const styleA = {
fill: this.codeAColor,
fontSize: trainConsts.codeFontSize,
};
const styleB = {
fill: this.codeBColor,
fontSize: trainConsts.codeFontSize,
};
codeAGraph.style = styleA;
codeBGraph.style = styleB;
if (this.codeBText) {
const bodyAWH = codeAGraph.getLocalBounds();
const bodyBWH = codeBGraph.getLocalBounds();
codeAGraph.position.set(-bodyBWH.width / 2, 0);
codeBGraph.position.set(bodyAWH.width / 2, 0);
}
if (this.train.constDatas.hasBodyRact) {
const bodyRact = this.bodyRact;
const { width: bodyWidth, height: bodyHeight } = this.getBodyWH();
bodyRact.lineStyle(trainConsts.borderWidth, new Color(trainConsts.borderColor));
const bgColor = trainConsts.bodyBgColor;
bodyRact.beginFill(new Color(bgColor));
bodyRact.drawRect(-bodyWidth / 2, -bodyHeight / 2, bodyWidth, bodyHeight);
bodyRact.endFill();
}
}
}
class StatusText extends Container {
sText = new VectorText('');
train;
constructor(train) {
super();
this.train = train;
this.addChild(this.sText);
}
doRepaint(text, bodyWH) {
const trainConsts = this.train.constDatas;
let t = text;
if (trainConsts.statusTextTransform) {
t = trainConsts.statusTextTransform[text];
}
this.sText.text = t;
this.sText.anchor.set(0.5);
const c = trainConsts.statusTextColor[text] || trainConsts.statusTextColor.D;
const style = {
fill: c,
fontSize: trainConsts.textFontSize,
};
this.sText.style = style;
const { width: bodyWidth, height: bodyHeight } = bodyWH;
const { width: textHWidth, height: textHeight } = this.sText.getLocalBounds();
const num = trainConsts.statusTextList.length;
let index = trainConsts.statusTextList.findIndex((item) => {
return item == text;
});
if (index < 0) {
index = (num - 1) / 2; // 中间
}
const textMargin = (bodyWidth - textHWidth * num) / (num - 1);
this.sText.position.set(-bodyWidth / 2 + (textHWidth * (index * 2 + 1)) / 2 + textMargin * index, -bodyHeight / 2 - textHeight / 2 - trainConsts.textMarginY);
}
clear() {
this.sText.text = '';
}
}
/**
* 列车
*/
class Train extends JlGraphic {
static Type = 'Train';
trainHead;
trainbody;
statusTextMap = new Map();
isRightRoTop; // 方向是否向右或者向上
constDatas;
constructor(data) {
super(Train.Type);
this.isRightRoTop = false;
this.constDatas = getTrainConsts();
if (data) {
Object.assign(this.constDatas, data);
}
this.trainbody = new TrainBody(this);
this.trainHead = new TrainHead(this);
this.addChild(this.trainHead);
this.addChild(this.trainbody);
}
get datas() {
return this.getDatas();
}
doRepaint() {
this.trainbody.doRepaint();
this.trainHead.doRepaint();
}
// 设置列车是否显示停止
setIsStop(v) {
this.trainHead.isStop = v;
}
// 设置列车箭头是否显示
setArrowVisible(v) {
this.trainHead.arrow.visible = v;
}
// 设置列车暂停是否显示
setPauseVisible(v) {
this.trainHead.pause.visible = v;
}
run() {
this.trainHead.arrow.visible = true;
this.trainHead.pause.visible = !this.constDatas.arrowPauseOnlyOne;
}
stop() {
this.trainHead.arrow.visible = false;
this.trainHead.pause.visible = true;
}
setCodeAText(v) {
this.trainbody.codeAText = v;
}
setCodeBText(v) {
this.trainbody.codeBText = v;
}
// 设置驾驶模式对应颜色
setDiriveModelColor(s) {
const DiriveModelColorEnum = this.constDatas.DiriveModelColorEnum;
let aColor = DiriveModelColorEnum.AM;
let pColor = DiriveModelColorEnum.SM;
if (s == EnumDiriveModel.SM) {
aColor = DiriveModelColorEnum.SM;
pColor = DiriveModelColorEnum.SM;
}
else if (s == EnumDiriveModel.RM) {
aColor = DiriveModelColorEnum.RM;
pColor = DiriveModelColorEnum.RM;
}
this.trainHead.arrowColor = aColor;
this.trainHead.pauseColor = pColor;
}
// 设置列车类型对应颜色
setTrainTypeColor(s) {
const typeColorEnum = this.constDatas.typeColorEnum;
const fillAColor = typeColorEnum.schedule;
let fillBColor = typeColorEnum.schedule;
if (s == EnumTrainType.late) {
fillBColor = typeColorEnum.late;
}
else if (s == EnumTrainType.early) {
fillBColor = typeColorEnum.early;
}
else if (s == EnumTrainType.head) {
fillBColor = typeColorEnum.head;
}
else if (s == EnumTrainType.manual) {
fillBColor = typeColorEnum.manual;
}
this.trainbody.codeAColor = fillAColor;
this.trainbody.codeBColor = fillBColor;
}
// 显示列车状态文字
showStatus(s) {
if (this.statusTextMap.has(s)) {
return;
}
const bodyWH = this.trainbody.getBodyWH();
const textD = new StatusText(this);
textD.doRepaint(s, bodyWH);
this.addChild(textD);
this.statusTextMap.set(s, textD);
}
// 隐藏列车状态文字
hideStatus(s) {
if (!this.statusTextMap.has(s)) {
return;
}
const textD = this.statusTextMap.get(s);
if (textD) {
textD.clear();
this.statusTextMap.delete(s);
}
}
}
export { Train };

64
components/Train/TrainConfig.d.ts vendored Normal file
View File

@ -0,0 +1,64 @@
import { GraphicData } from "jl-graphic";
export interface ITrainConstsConfig {
bodyWidth: number;
bodyHeight: number;
bodyPadding: number;
borderWidth: number;
codeFontSize: number;
textFontSize: number;
textMarginY: number;
statusTextList: EnumStatusText[];
marginX: number;
pauseW: number;
bodyBgColor?: string;
codeColor: string;
borderColor: string;
arrowDefaultColor: string;
pauseDefaultColor: string;
DiriveModelColorEnum: DiriveModelColor;
typeColorEnum: TypeColor;
statusTextColor: IStatusTextColor;
statusTextTransform?: IStatusTextColor;
arrowPauseOnlyOne: boolean;
hasBodyRact: boolean;
}
export type UpdateTrainConsts = Partial<ITrainConstsConfig>;
export declare enum EnumDiriveModel {
AM = "AM",// ATO自动驾驶
SM = "SM",// ATP 监控下的人工驾驶模式
RM = "RM",// 限制人工驾驶模式
NRM = "NRM",// 非限制人工驾驶模式
red = "red"
}
export type DiriveModelColor = {
[key in EnumDiriveModel]: string;
};
export declare enum EnumTrainType {
accuracy = "accuracy",// 准点
early = "early",// 早点
late = "late",// 晚点
schedule = "schedule",// 计划车
head = "head",// 头码车
manual = "manual",// 人工车
special = "special"
}
export type TypeColor = {
[key in EnumTrainType]: string;
};
export declare enum EnumStatusText {
H = "H",// H扣车
S = "S",// S跳停
D = "D",// D开门
A = "A"
}
export type IStatusTextColor = {
[key in EnumStatusText]: string;
};
export interface ITrainData extends GraphicData {
get code(): string;
set code(v: string);
clone(): ITrainData;
copyFrom(data: ITrainData): void;
eq(other: ITrainData): boolean;
}
export declare function getTrainConsts(): ITrainConstsConfig;

View File

@ -0,0 +1,72 @@
var EnumDiriveModel;
(function (EnumDiriveModel) {
EnumDiriveModel["AM"] = "AM";
EnumDiriveModel["SM"] = "SM";
EnumDiriveModel["RM"] = "RM";
EnumDiriveModel["NRM"] = "NRM";
EnumDiriveModel["red"] = "red";
})(EnumDiriveModel || (EnumDiriveModel = {}));
var EnumTrainType;
(function (EnumTrainType) {
EnumTrainType["accuracy"] = "accuracy";
EnumTrainType["early"] = "early";
EnumTrainType["late"] = "late";
EnumTrainType["schedule"] = "schedule";
EnumTrainType["head"] = "head";
EnumTrainType["manual"] = "manual";
EnumTrainType["special"] = "special";
})(EnumTrainType || (EnumTrainType = {}));
var EnumStatusText;
(function (EnumStatusText) {
EnumStatusText["H"] = "H";
EnumStatusText["S"] = "S";
EnumStatusText["D"] = "D";
EnumStatusText["A"] = "A";
// '>>' = '>>', // 列车重叠,点击可切换列车
})(EnumStatusText || (EnumStatusText = {}));
function getTrainConsts() {
const trainConsts = {
bodyWidth: 120,
bodyHeight: 40,
bodyPadding: 5,
borderWidth: 1,
codeFontSize: 22,
textFontSize: 16, // 状态字母大小
textMarginY: 10, // 状态字母与列车距离
statusTextList: [EnumStatusText.H, EnumStatusText.S, EnumStatusText.D, EnumStatusText.A],
marginX: 4, // 图形x轴边距
pauseW: 4, // 停止框宽度
codeColor: '0xffffff', // 车号颜色
borderColor: '0xA3E198', // 边框的颜色
bodyBgColor: '0x737373', // body背景色
arrowDefaultColor: '0x00FF00', // 箭头默认颜色
pauseDefaultColor: '0x00FF00', // 停止默认颜色
DiriveModelColorEnum: {
AM: '0x00FF00', // ATO自动驾驶
SM: '0xFFFF00', // ATP 监控下的人工驾驶模式
RM: '0xFFC837', // 限制人工驾驶模式
NRM: '0xA0522D', // 非限制人工驾驶模式
red: '0xF80103', // 红色表示通信中断
},
typeColorEnum: {
accuracy: '0xffffff', // 准点
early: '0x00FF00', // 早点
late: '0xFFFF00', // 晚点
schedule: '0xffffff', // 计划车
head: '0xE9FC01', // 头码车
manual: '0xE9FC01', // 人工车
special: '0xE9FC01', // 特殊车
},
statusTextColor: {
H: '0xFFFF00', // H扣车
S: '0x6260F3', // S跳停
D: '0x00FF00', // D开门
A: '0xFF0000', // A报警
},
arrowPauseOnlyOne: false,
hasBodyRact: true, // 有body矩形
};
return trainConsts;
}
export { EnumDiriveModel, EnumStatusText, EnumTrainType, getTrainConsts };

View File

@ -1,23 +1,6 @@
import { Container, Graphics } from 'pixi.js';
import { GraphicData, JlGraphic, JlGraphicTemplate, VectorText } from 'jl-graphic';
import { CategoryType } from '../CategoryType';
import { TransponderTypeEnum } from './TransponderConfig';
export interface ITransponderData extends GraphicData {
get code(): string;
set code(v: string);
get centralizedStations(): number[];
set centralizedStations(v: number[]);
get fixedTelegram(): Uint8Array;
set fixedTelegram(v: Uint8Array);
get type(): TransponderTypeEnum;
set type(v: TransponderTypeEnum);
clone(): ITransponderData;
copyFrom(data: ITransponderData): void;
eq(other: ITransponderData): boolean;
}
export declare const transponderTypePoints: {
[x: string]: number[][];
};
import { JlGraphic, VectorText } from 'jl-graphic';
import { ITransponderData, ITransponderConsts, UpdateTransponderConsts } from './TransponderConfig';
export declare class TransponderCode extends Container {
codeText: VectorText;
name: string;
@ -29,15 +12,9 @@ export declare class Transponder extends JlGraphic {
static Type: string;
polygonGraphic: Graphics;
labelGraphic: TransponderCode;
private categoryType;
constructor(categoryType: CategoryType);
getConstDatas(): void;
constDatas: ITransponderConsts;
constructor(data?: UpdateTransponderConsts);
get datas(): ITransponderData;
clear(): void;
doRepaint(): void;
}
export declare class TransponderTemplate extends JlGraphicTemplate<Transponder> {
categoryType: CategoryType;
constructor(dataTemplate: ITransponderData, gategoryConsts: CategoryType);
new(): Transponder;
}

View File

@ -1,90 +1,7 @@
import { Container, Graphics } from 'pixi.js';
import { VectorText, JlGraphic, JlGraphicTemplate } from 'jl-graphic';
import { TransponderTypeEnum, TransponderConstsMap } from './TransponderConfig.js';
import { VectorText, JlGraphic } from 'jl-graphic';
import { getTransponderConsts, getTypePoints, TransponderTypeEnum } from './TransponderConfig.js';
let TransponderConsts = {
height: 12,
lineWidth: 2,
lineColor: '0xFFFFFF',
wblineColor: '0xFF0000',
textFontSize: 12,
textMarginY: 5, // 名称与应答器的距离
vblineColor: '0xFF00FF',
iblineColor: '0x0000FF',
};
const transponderTypePoints = {
[TransponderTypeEnum[TransponderTypeEnum.FB]]: [
[-TransponderConsts.height / 2, -TransponderConsts.height / 2],
[TransponderConsts.height / 2, -TransponderConsts.height / 2],
[TransponderConsts.height / 2, TransponderConsts.height / 2],
[-TransponderConsts.height / 2, TransponderConsts.height / 2],
[
-TransponderConsts.height / 2,
-TransponderConsts.height / 2 - TransponderConsts.lineWidth / 2,
],
[-TransponderConsts.height / 2, -TransponderConsts.height / 2],
[TransponderConsts.height / 2, TransponderConsts.height / 2],
[TransponderConsts.height / 2, -TransponderConsts.height / 2],
[-TransponderConsts.height / 2, TransponderConsts.height / 2],
],
[TransponderTypeEnum[TransponderTypeEnum.WB]]: [
[-TransponderConsts.height / 2, -TransponderConsts.height / 2],
[TransponderConsts.height / 2, -TransponderConsts.height / 2],
[TransponderConsts.height / 2, TransponderConsts.height / 2],
[-TransponderConsts.height / 2, TransponderConsts.height / 2],
[
-TransponderConsts.height / 2,
-TransponderConsts.height / 2 - TransponderConsts.lineWidth / 2,
],
[0, -TransponderConsts.height / 2],
[0, TransponderConsts.height / 2],
[TransponderConsts.height / 2, 0],
[-TransponderConsts.height / 2, 0],
],
[TransponderTypeEnum[TransponderTypeEnum.DB]]: [
[-TransponderConsts.height, -TransponderConsts.height / 2],
[TransponderConsts.height, -TransponderConsts.height / 2],
[TransponderConsts.height, TransponderConsts.height / 2],
[-TransponderConsts.height, TransponderConsts.height / 2],
[
-TransponderConsts.height,
-TransponderConsts.height / 2 - TransponderConsts.lineWidth / 2,
],
[-TransponderConsts.height, -TransponderConsts.height / 2],
[TransponderConsts.height, TransponderConsts.height / 2],
[TransponderConsts.height, -TransponderConsts.height / 2],
[-TransponderConsts.height, TransponderConsts.height / 2],
],
[TransponderTypeEnum[TransponderTypeEnum.VB]]: [
[-TransponderConsts.height / 2, -TransponderConsts.height / 2],
[TransponderConsts.height / 2, -TransponderConsts.height / 2],
[TransponderConsts.height / 2, TransponderConsts.height / 2],
[-TransponderConsts.height / 2, TransponderConsts.height / 2],
[
-TransponderConsts.height / 2,
-TransponderConsts.height / 2 - TransponderConsts.lineWidth / 2,
],
],
[TransponderTypeEnum[TransponderTypeEnum.IB]]: [
[-TransponderConsts.height / 2, -TransponderConsts.height / 2],
[TransponderConsts.height / 2, -TransponderConsts.height / 2],
[TransponderConsts.height / 2, TransponderConsts.height / 2],
[-TransponderConsts.height / 2, TransponderConsts.height / 2],
[
-TransponderConsts.height / 2,
-TransponderConsts.height / 2 - TransponderConsts.lineWidth / 2,
],
[0, -TransponderConsts.height / 2],
[-TransponderConsts.height / 2, 0],
[-TransponderConsts.height / 2, TransponderConsts.height / 2],
[
TransponderConsts.height / 2,
-TransponderConsts.height / 2 + TransponderConsts.lineWidth / 2,
],
[TransponderConsts.height / 2, 0],
[0, TransponderConsts.height / 2],
],
};
class TransponderCode extends Container {
codeText = new VectorText('');
name = 'transponderCode';
@ -104,18 +21,14 @@ class Transponder extends JlGraphic {
static Type = 'Transponder';
polygonGraphic = new Graphics();
labelGraphic = new TransponderCode();
categoryType;
constructor(categoryType) {
constDatas;
constructor(data) {
super(Transponder.Type);
this.addChild(this.polygonGraphic);
this.addChild(this.labelGraphic);
this.categoryType = categoryType;
this.getConstDatas();
}
getConstDatas() {
const constData = TransponderConstsMap.get(this.categoryType);
if (constData) {
TransponderConsts = constData;
this.constDatas = getTransponderConsts();
if (data) {
Object.assign(this.constDatas, data);
}
}
get datas() {
@ -128,20 +41,19 @@ class Transponder extends JlGraphic {
doRepaint() {
this.clear();
const polygonGraphic = this.polygonGraphic;
const type = TransponderTypeEnum[this.datas.type];
const ps = transponderTypePoints[type];
let lineColor = TransponderConsts.lineColor;
if (type == 'WB') {
lineColor = TransponderConsts.wblineColor;
const ps = getTypePoints(this.datas.type, this.constDatas);
let lineColor = this.constDatas.lineColor;
if (this.datas.type == TransponderTypeEnum.WB) {
lineColor = this.constDatas.wblineColor;
}
else if (type == 'VB') {
lineColor = TransponderConsts.vblineColor;
else if (this.datas.type == TransponderTypeEnum.VB) {
lineColor = this.constDatas.vblineColor;
}
else if (type == 'IB') {
lineColor = TransponderConsts.iblineColor;
else if (this.datas.type == TransponderTypeEnum.IB) {
lineColor = this.constDatas.iblineColor;
}
polygonGraphic.lineStyle(TransponderConsts.lineWidth, lineColor);
polygonGraphic.beginFill(TransponderConsts.lineColor, 0.00001); // 填充透明色(用于碰撞检测)
polygonGraphic.lineStyle(this.constDatas.lineWidth, lineColor);
polygonGraphic.beginFill(this.constDatas.lineColor, 0.00001); // 填充透明色(用于碰撞检测)
const indexArr = [0, 5, 7];
ps.forEach((item, index) => {
if (indexArr.includes(index)) {
@ -155,7 +67,7 @@ class Transponder extends JlGraphic {
this.labelGraphic.paint(this.datas);
const style = {
fill: lineColor,
fontSize: TransponderConsts.textFontSize,
fontSize: this.constDatas.textFontSize,
};
this.labelGraphic.codeText.style = style;
const codeTransform = this.datas?.childTransforms?.find((item) => item.name === 'transponderCode');
@ -168,23 +80,9 @@ class Transponder extends JlGraphic {
else {
const { height: polygonHeight } = this.polygonGraphic.getLocalBounds();
const { height: textHeight } = this.labelGraphic.getLocalBounds();
this.labelGraphic.position.set(0, polygonHeight / 2 + textHeight / 2 + TransponderConsts.textMarginY);
this.labelGraphic.position.set(0, polygonHeight / 2 + textHeight / 2 + this.constDatas.textMarginY);
}
}
}
class TransponderTemplate extends JlGraphicTemplate {
categoryType;
constructor(dataTemplate, gategoryConsts) {
super(Transponder.Type, {
dataTemplate,
});
this.categoryType = gategoryConsts;
}
new() {
const transponder = new Transponder(this.categoryType);
transponder.loadData(this.datas);
return transponder;
}
}
export { Transponder, TransponderCode, TransponderTemplate, transponderTypePoints };
export { Transponder, TransponderCode };

View File

@ -1,5 +1,4 @@
import { GraphicData } from 'jl-graphic';
import { CategoryType } from '../CategoryType';
export interface ITransponderData extends GraphicData {
get code(): string;
set code(v: string);
@ -20,7 +19,7 @@ export declare enum TransponderTypeEnum {
VB = 3,// 主信号应答器
IB = 4
}
export interface TransponderConstsConfig {
export interface ITransponderConsts {
height: number;
lineWidth: number;
lineColor: string;
@ -30,4 +29,15 @@ export interface TransponderConstsConfig {
vblineColor: string;
iblineColor: string;
}
export declare const TransponderConstsMap: Map<CategoryType, TransponderConstsConfig>;
export declare function getTypePoints(type: TransponderTypeEnum, TrConsts: ITransponderConsts): number[][];
export type UpdateTransponderConsts = Partial<ITransponderConsts>;
export declare function getTransponderConsts(): {
height: number;
lineWidth: number;
lineColor: string;
wblineColor: string;
textFontSize: number;
textMarginY: number;
vblineColor: string;
iblineColor: string;
};

View File

@ -1,5 +1,3 @@
import { CategoryType } from '../CategoryType.js';
var TransponderTypeEnum;
(function (TransponderTypeEnum) {
TransponderTypeEnum[TransponderTypeEnum["FB"] = 0] = "FB";
@ -8,16 +6,76 @@ var TransponderTypeEnum;
TransponderTypeEnum[TransponderTypeEnum["VB"] = 3] = "VB";
TransponderTypeEnum[TransponderTypeEnum["IB"] = 4] = "IB";
})(TransponderTypeEnum || (TransponderTypeEnum = {}));
const THConsts = {
height: 12,
lineWidth: 2,
lineColor: '0xFFFFFF',
wblineColor: '0xFF0000',
textFontSize: 12,
textMarginY: 5, // 名称与应答器的距离
vblineColor: '0xFF00FF',
iblineColor: '0x0000FF',
};
const TransponderConstsMap = new Map([[CategoryType.JK, THConsts], [CategoryType.TH, THConsts]]);
function getTypePoints(type, TrConsts) {
const transponderTypePoints = {
[TransponderTypeEnum.FB]: [
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
],
[TransponderTypeEnum.WB]: [
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
[0, -TrConsts.height / 2],
[0, TrConsts.height / 2],
[TrConsts.height / 2, 0],
[-TrConsts.height / 2, 0],
],
[TransponderTypeEnum.DB]: [
[-TrConsts.height, -TrConsts.height / 2],
[TrConsts.height, -TrConsts.height / 2],
[TrConsts.height, TrConsts.height / 2],
[-TrConsts.height, TrConsts.height / 2],
[-TrConsts.height, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
[-TrConsts.height, -TrConsts.height / 2],
[TrConsts.height, TrConsts.height / 2],
[TrConsts.height, -TrConsts.height / 2],
[-TrConsts.height, TrConsts.height / 2],
],
[TransponderTypeEnum.VB]: [
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
],
[TransponderTypeEnum.IB]: [
[-TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2],
[TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, TrConsts.height / 2],
[-TrConsts.height / 2, -TrConsts.height / 2 - TrConsts.lineWidth / 2],
[0, -TrConsts.height / 2],
[-TrConsts.height / 2, 0],
[-TrConsts.height / 2, TrConsts.height / 2],
[TrConsts.height / 2, -TrConsts.height / 2 + TrConsts.lineWidth / 2],
[TrConsts.height / 2, 0],
[0, TrConsts.height / 2],
],
};
return transponderTypePoints[type];
}
function getTransponderConsts() {
const transponderConsts = {
height: 12,
lineWidth: 2,
lineColor: '0xFFFFFF',
wblineColor: '0xFF0000',
textFontSize: 12,
textMarginY: 5, // 名称与应答器的距离
vblineColor: '0xFF00FF',
iblineColor: '0x0000FF',
};
return transponderConsts;
}
export { TransponderConstsMap, TransponderTypeEnum };
export { TransponderTypeEnum, getTransponderConsts, getTypePoints };

View File

@ -4,7 +4,7 @@
"description": "图形库",
"type": "module",
"private": true,
"main": "dist/",
"main": "components",
"repository": {
"type": "git",
"url": "https://git.code.tencent.com/jl-framework/rt-graphic-component.git"
@ -12,10 +12,11 @@
"author": "",
"license": "ISC",
"scripts": {
"build": "rollup -c rollup.config.cjs"
"build": "rollup -c rollup.config.cjs",
"test": "node ./test.cjs"
},
"dependencies": {
"jl-graphic": "git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#v0.1.0"
"jl-graphic": "git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#v0.1.3"
},
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.5",

View File

@ -1,35 +1,43 @@
const { resolve } = require("path");
const { readdirSync } = require("fs");
const typescript = require("@rollup/plugin-typescript");
const { resolve, relative, extname } = require('path');
const { readdirSync } = require('fs');
const typescript = require('@rollup/plugin-typescript');
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
external: ["jl-graphic"],
input: getEntryPoints(),
external: ['jl-graphic'],
input: getEntryPoints('src/packages', 'src/packages'),
output: {
dir: "components",
format: "esm",
dir: 'components',
format: 'esm',
preserveModules: true,
},
plugins: [
typescript({
tsconfig: "./tsconfig.json",
tsconfig: './tsconfig.json',
compilerOptions: {
declaration: true,
declarationDir: "components",
declarationDir: 'components',
},
}),
],
};
module.exports = config;
function getEntryPoints() {
const packageDir = resolve(__dirname, "src/packages");
const entryPoints = readdirSync(packageDir, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => resolve(packageDir, dirent.name, `${dirent.name}.ts`));
console.log(entryPoints);
return entryPoints;
function getEntryPoints(dir, root) {
let entries = {};
const items = readdirSync(dir, { withFileTypes: true });
for (const item of items) {
const fullPath = resolve(dir, item.name);
const relativePath = relative(root, fullPath);
const relativeName = relativePath.replace(extname(item.name), '');
if (item.isDirectory()) {
const subentries = getEntryPoints(fullPath, root);
entries = { ...entries, ...subentries };
} else {
entries[relativeName] = fullPath;
}
}
return entries;
}

View File

@ -323,13 +323,6 @@
picocolors "^1.0.0"
tslib "^2.6.0"
"@rollup/plugin-alias@^5.1.0":
version "5.1.0"
resolved "https://registry.npmmirror.com/@rollup/plugin-alias/-/plugin-alias-5.1.0.tgz#99a94accc4ff9a3483be5baeedd5d7da3b597e93"
integrity sha512-lpA3RZ9PdIG7qqhEfv79tBffNaoDuukFDrmhLqg9ifv99u/ehn+lOg30x2zmhf8AQqQUZaMk/B9fZraQ6/acDQ==
dependencies:
slash "^4.0.0"
"@rollup/plugin-typescript@^11.1.5":
version "11.1.5"
resolved "https://registry.npmmirror.com/@rollup/plugin-typescript/-/plugin-typescript-11.1.5.tgz#039c763bf943a5921f3f42be255895e75764cb91"
@ -731,7 +724,7 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4
resolved "https://registry.npmmirror.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800"
integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==
eslint@^8.55.0, eslint@^8.56.0:
eslint@^8.56.0:
version "8.56.0"
resolved "https://registry.npmmirror.com/eslint/-/eslint-8.56.0.tgz#4957ce8da409dc0809f99ab07a1b94832ab74b15"
integrity sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==
@ -1182,17 +1175,13 @@ ismobilejs@^1.1.0:
resolved "https://registry.npmmirror.com/ismobilejs/-/ismobilejs-1.1.1.tgz#c56ca0ae8e52b24ca0f22ba5ef3215a2ddbbaa0e"
integrity sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==
"jl-graphic@git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#v0.1.0":
version "0.0.1"
resolved "git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#95de26aad236a7ed2bed23bf82d1c28cbcc7bc73"
"jl-graphic@git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#v0.1.3":
version "0.1.3"
resolved "git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#100ddafc75ffa2fc646ad26359682e0f083511e3"
dependencies:
"@pixi/graphics-extras" "^7.3.2"
"@pixi/utils" "^7.3.2"
"@rollup/plugin-alias" "^5.1.0"
"@stomp/stompjs" "^7.0.0"
eslint "^8.55.0"
eslint-config-prettier "^9.1.0"
eslint-plugin-prettier "^5.0.1"
mqtt "^5.2.1"
pixi-viewport "^5.0.1"
pixi.js "^7.3.2"
@ -1702,11 +1691,6 @@ signal-exit@^3.0.3, signal-exit@^3.0.7:
resolved "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
slash@^4.0.0:
version "4.0.0"
resolved "https://registry.npmmirror.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7"
integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==
split2@^4.2.0:
version "4.2.0"
resolved "https://registry.npmmirror.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4"