站台车站初提交

This commit is contained in:
joylink_zhaoerwei 2024-01-10 15:46:15 +08:00
parent f847d5f101
commit 8afd91f515
45 changed files with 701 additions and 710 deletions

View File

@ -1,3 +1,11 @@
export declare enum StyleType {
GP = "GP",//北京测试: 轨旁 GP
TH = "TH",//西安NCC/西安1、3号线/福州1号线/标准线/佛山1号线/西安3:通号 TH
KSK = "KSK",//宁波1号线 卡斯柯
ZDWX = "ZDWX",//西安2号线/成都1号线 浙大网新
KSSSSK = "SSS",//南京2号线 十四所
TLZ = "TLZ"
}
export declare enum DevicePort { export declare enum DevicePort {
A = 0, A = 0,
B = 1, B = 1,

View File

@ -1,3 +1,12 @@
var StyleType;
(function (StyleType) {
StyleType["GP"] = "GP";
StyleType["TH"] = "TH";
StyleType["KSK"] = "KSK";
StyleType["ZDWX"] = "ZDWX";
StyleType["KSSSSK"] = "SSS";
StyleType["TLZ"] = "TLZ";
})(StyleType || (StyleType = {}));
var DevicePort; var DevicePort;
(function (DevicePort) { (function (DevicePort) {
DevicePort[DevicePort["A"] = 0] = "A"; DevicePort[DevicePort["A"] = 0] = "A";
@ -38,4 +47,4 @@ var IRelatedRef;
IRelatedRef.create = create; IRelatedRef.create = create;
})(IRelatedRef || (IRelatedRef = {})); })(IRelatedRef || (IRelatedRef = {}));
export { DevicePort, DeviceType, Direction, IRelatedRef }; export { DevicePort, DeviceType, Direction, IRelatedRef, StyleType };

View File

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

View File

@ -3,7 +3,7 @@ import { JlPlatform } from './JlPlatform';
export interface IBeiJingPlatformState extends GraphicState { export interface IBeiJingPlatformState extends GraphicState {
id?: number; id?: number;
} }
export declare class BeiJingPlatform extends JlPlatform { export declare class GPPlatform extends JlPlatform {
constructor(); constructor();
get states(): IBeiJingPlatformState; get states(): IBeiJingPlatformState;
doRepaint(): void; doRepaint(): void;

View File

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

View File

@ -1,52 +1,54 @@
import { JlGraphic, VectorText } from 'jl-graphic'; import { JlGraphic, VectorText } from 'jl-graphic';
import { Container, Graphics } from 'pixi.js'; import { Container, Graphics } from 'pixi.js';
import { CategoryType, IPlatformData, PlatformConstsConfig } from './PlatformConfig'; import { IPlatformData, PlatformConstsConfig } from './PlatformConfig';
import { StyleType } from 'common/common';
declare class RectGraphic extends Container { declare class RectGraphic extends Container {
categoryType: CategoryType;
rect: Graphics; rect: Graphics;
stateFillColor?: string; stateFillColor?: string;
constructor(categoryType: CategoryType); constructor();
draw(platformConsts: PlatformConstsConfig): void; draw(platformConsts: PlatformConstsConfig): void;
clear(): void; clear(): void;
} }
declare class DoorGraphic extends Container { declare class DoorGraphic extends Container {
categoryType: CategoryType;
doorGraphic: Graphics; doorGraphic: Graphics;
doorCloseGraphic: Graphics; doorCloseGraphic: Graphics;
stateFillColor?: string; stateFillColor?: string;
constructor(categoryType: CategoryType); constructor();
draw(platformConsts: PlatformConstsConfig): void; draw(platformConsts: PlatformConstsConfig): void;
clear(): void; clear(): void;
} }
declare class CodeGraphic extends Container { declare class CodeGraphic extends Container {
categoryType: CategoryType;
character: VectorText; character: VectorText;
runLevel: VectorText; runLevel: VectorText;
runTime: VectorText; runTime: VectorText;
stopTime: VectorText; stopTime: VectorText;
circle: Graphics; circle: Graphics;
constructor(categoryType: CategoryType, platformConsts: PlatformConstsConfig); constructor(platformConsts: PlatformConstsConfig);
draw(platformConsts: PlatformConstsConfig): void; draw(platformConsts: PlatformConstsConfig): void;
clear(): void; clear(): void;
} }
declare class LozengeGraphic extends Container { declare class LozengeGraphic extends Container {
categoryType: CategoryType;
lozenge: Graphics; lozenge: Graphics;
constructor(categoryType: CategoryType); constructor();
draw(platformConsts: PlatformConstsConfig): void; draw(platformConsts: PlatformConstsConfig): void;
clear(): void; clear(): void;
} }
export declare class DoorCodeLozenge extends Container {
private styleType;
private platformConsts;
doorGraphic: DoorGraphic;
lozengeGraphic: LozengeGraphic;
codeGraphic: CodeGraphic;
constructor(styleType: StyleType);
draw(hasDoor: boolean, direction: string): void;
}
export declare abstract class JlPlatform extends JlGraphic { export declare abstract class JlPlatform extends JlGraphic {
static Type: string; static Type: string;
private categoryType;
private platformConsts; private platformConsts;
rectGraphic: RectGraphic; rectGraphic: RectGraphic;
doorGraphic?: DoorGraphic; constructor(platformConsts: PlatformConstsConfig);
lozengeGraphic?: LozengeGraphic;
codeGraphic?: CodeGraphic;
constructor(categoryType: CategoryType);
get datas(): IPlatformData; get datas(): IPlatformData;
get code(): string; get code(): string;
doRepaint(): void; draw(): void;
} }
export {}; export {};

View File

@ -1,15 +1,13 @@
import { JlGraphic, calculateMirrorPoint, getRectangleCenter, VectorText } from 'jl-graphic'; import { calculateMirrorPoint, JlGraphic, getRectangleCenter, VectorText } from 'jl-graphic';
import { Point, Container, Graphics, Color, Rectangle } from 'pixi.js'; import { Container, Point, Graphics, Color, Rectangle } from 'pixi.js';
import { platformConstsMap } from './PlatformConfig.js'; import { platformConstsMap } from './PlatformConfig.js';
//子元素--矩形 //子元素--矩形
class RectGraphic extends Container { class RectGraphic extends Container {
categoryType;
rect; rect;
stateFillColor; stateFillColor;
constructor(categoryType) { constructor() {
super(); super();
this.categoryType = categoryType;
this.rect = new Graphics(); this.rect = new Graphics();
this.addChild(this.rect); this.addChild(this.rect);
} }
@ -29,13 +27,11 @@ class RectGraphic extends Container {
} }
//子元素--门 //子元素--门
class DoorGraphic extends Container { class DoorGraphic extends Container {
categoryType;
doorGraphic; doorGraphic;
doorCloseGraphic; doorCloseGraphic;
stateFillColor; stateFillColor;
constructor(categoryType) { constructor() {
super(); super();
this.categoryType = categoryType;
this.doorGraphic = new Graphics(); this.doorGraphic = new Graphics();
this.doorCloseGraphic = new Graphics(); this.doorCloseGraphic = new Graphics();
this.addChild(this.doorGraphic); this.addChild(this.doorGraphic);
@ -67,15 +63,13 @@ class DoorGraphic extends Container {
} }
//子元素--字符 //子元素--字符
class CodeGraphic extends Container { class CodeGraphic extends Container {
categoryType;
character = new VectorText(''); //扣车H character = new VectorText(''); //扣车H
runLevel = new VectorText(''); //运行等级 runLevel = new VectorText(''); //运行等级
runTime = new VectorText(''); //运行时间 runTime = new VectorText(''); //运行时间
stopTime = new VectorText(''); //停站时间 stopTime = new VectorText(''); //停站时间
circle = new Graphics(); circle = new Graphics();
constructor(categoryType, platformConsts) { constructor(platformConsts) {
super(); super();
this.categoryType = categoryType;
this.addChild(this.character); this.addChild(this.character);
this.addChild(this.runLevel); this.addChild(this.runLevel);
this.addChild(this.circle); this.addChild(this.circle);
@ -138,11 +132,9 @@ class CodeGraphic extends Container {
} }
//子元素--站台旁菱形图标 //子元素--站台旁菱形图标
class LozengeGraphic extends Container { class LozengeGraphic extends Container {
categoryType;
lozenge; lozenge;
constructor(categoryType) { constructor() {
super(); super();
this.categoryType = categoryType;
this.lozenge = new Graphics(); this.lozenge = new Graphics();
this.addChild(this.lozenge); this.addChild(this.lozenge);
} }
@ -164,56 +156,42 @@ class LozengeGraphic extends Container {
this.lozenge.clear(); this.lozenge.clear();
} }
} }
class JlPlatform extends JlGraphic { class DoorCodeLozenge extends Container {
static Type = 'Platform'; styleType;
categoryType;
platformConsts; platformConsts;
rectGraphic;
doorGraphic; doorGraphic;
lozengeGraphic; lozengeGraphic;
codeGraphic; codeGraphic;
constructor(categoryType) { constructor(styleType) {
super(JlPlatform.Type); super();
this.categoryType = categoryType; this.styleType = styleType;
this.platformConsts = platformConstsMap.get(this.categoryType); this.platformConsts = platformConstsMap.get(this.styleType);
this.rectGraphic = new RectGraphic(categoryType); this.doorGraphic = new DoorGraphic();
this.addChild(this.rectGraphic);
if (this.platformConsts.doorGraphic) {
this.doorGraphic = new DoorGraphic(categoryType);
this.addChild(this.doorGraphic); this.addChild(this.doorGraphic);
} this.lozengeGraphic = new LozengeGraphic();
if (this.platformConsts.lozengeGraphic) {
this.lozengeGraphic = new LozengeGraphic(categoryType);
this.addChild(this.lozengeGraphic); this.addChild(this.lozengeGraphic);
} this.codeGraphic = new CodeGraphic(this.platformConsts);
if (this.platformConsts.codeGraphic) {
this.codeGraphic = new CodeGraphic(categoryType, this.platformConsts);
this.addChild(this.codeGraphic); this.addChild(this.codeGraphic);
} }
} draw(hasDoor, direction) {
get datas() {
return this.getDatas();
}
get code() {
return this.datas.code;
}
doRepaint() {
this.doorGraphic?.clear();
const platformConsts = this.platformConsts; const platformConsts = this.platformConsts;
this.rectGraphic.draw(platformConsts); this.doorGraphic.clear();
if (this.datas.hasdoor && this.doorGraphic) { if (hasDoor) {
const doorConsts = platformConsts.doorGraphic; const doorConsts = platformConsts.doorGraphic;
this.doorGraphic.draw(platformConsts); this.doorGraphic.draw(platformConsts);
this.doorGraphic.position.set(0, -platformConsts.height / 2 - doorConsts.doorPlatformSpacing); 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.codeGraphic) {
const codeConsts = platformConsts.codeGraphic; const codeConsts = platformConsts.codeGraphic;
this.codeGraphic.draw(platformConsts); this.codeGraphic.draw(platformConsts);
this.codeGraphic.position.set(0, 0); this.codeGraphic.position.set(0, 0);
if (this.datas.direction == 'down') { const LozengeConsts = platformConsts.lozengeGraphic;
this.lozengeGraphic.draw(platformConsts);
this.lozengeGraphic.position.set(0, -platformConsts.height / 2 -
LozengeConsts.doorPlatformSpacing -
platformConsts.height / 3);
if (direction == 'down') {
this.doorGraphic.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.doorGraphic.position));
this.lozengeGraphic.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.lozengeGraphic.position));
const psChange = [ const psChange = [
this.codeGraphic.character, this.codeGraphic.character,
this.codeGraphic.runLevel, this.codeGraphic.runLevel,
@ -230,17 +208,26 @@ class JlPlatform extends JlGraphic {
(codeConsts.besideSpacing * 4) / 3, (-platformConsts.height * 10) / 11); (codeConsts.besideSpacing * 4) / 3, (-platformConsts.height * 10) / 11);
} }
} }
if (this.lozengeGraphic) {
const LozengeConsts = platformConsts.lozengeGraphic;
this.lozengeGraphic.draw(platformConsts);
this.lozengeGraphic.position.set(0, -platformConsts.height / 2 -
LozengeConsts.doorPlatformSpacing -
platformConsts.height / 3);
if (this.datas.direction == 'down') {
this.lozengeGraphic.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.lozengeGraphic.position));
} }
class JlPlatform extends JlGraphic {
static Type = 'Platform';
platformConsts;
rectGraphic;
constructor(platformConsts) {
super(JlPlatform.Type);
this.platformConsts = platformConsts;
this.rectGraphic = new RectGraphic();
this.addChild(this.rectGraphic);
} }
get datas() {
return this.getDatas();
}
get code() {
return this.datas.code;
}
draw() {
this.rectGraphic.draw(this.platformConsts);
} }
} }
export { JlPlatform }; export { DoorCodeLozenge, JlPlatform };

View File

@ -1,8 +1,5 @@
import { StyleType } from 'common/common';
import { GraphicData } from 'jl-graphic'; import { GraphicData } from 'jl-graphic';
export declare enum CategoryType {
BeiJing = "BeiJing",//北京
XiAn = "XiAn"
}
export interface PlatformConstsConfig { export interface PlatformConstsConfig {
width: number; width: number;
height: number; height: number;
@ -35,7 +32,7 @@ export interface LozengeConstsConfig {
lozengeRed: string; lozengeRed: string;
doorPlatformSpacing: number; doorPlatformSpacing: number;
} }
export declare const BeiJingConsts: { export declare const GPConsts: {
width: number; width: number;
height: number; height: number;
lineWidth: number; lineWidth: number;
@ -43,7 +40,7 @@ export declare const BeiJingConsts: {
trainStop: string; trainStop: string;
trainJump: string; trainJump: string;
}; };
export declare const XiAnConsts: { export declare const THConsts: {
width: number; width: number;
height: number; height: number;
lineWidth: number; lineWidth: number;
@ -72,7 +69,7 @@ export declare const XiAnConsts: {
doorPlatformSpacing: number; doorPlatformSpacing: number;
}; };
}; };
export declare const platformConstsMap: Map<CategoryType, PlatformConstsConfig>; export declare const platformConstsMap: Map<StyleType, PlatformConstsConfig>;
declare enum TypeOfPlatform { declare enum TypeOfPlatform {
Unknown = 0, Unknown = 0,
up = 1, up = 1,

View File

@ -1,9 +1,6 @@
var CategoryType; import { StyleType } from '../../common/common.js';
(function (CategoryType) {
CategoryType["BeiJing"] = "BeiJing"; const GPConsts = {
CategoryType["XiAn"] = "XiAn";
})(CategoryType || (CategoryType = {}));
const BeiJingConsts = {
width: 90, width: 90,
height: 20, height: 20,
lineWidth: 3, lineWidth: 3,
@ -11,7 +8,7 @@ const BeiJingConsts = {
trainStop: '0xfbff00', trainStop: '0xfbff00',
trainJump: '0xC0C0FE', trainJump: '0xC0C0FE',
}; };
const XiAnConsts = { const THConsts = {
width: 90, width: 90,
height: 20, height: 20,
lineWidth: 3, lineWidth: 3,
@ -41,8 +38,8 @@ const XiAnConsts = {
}, },
}; };
const platformConstsMap = new Map([ const platformConstsMap = new Map([
[CategoryType.BeiJing, BeiJingConsts], [StyleType.GP, GPConsts],
[CategoryType.XiAn, XiAnConsts], [StyleType.TH, THConsts],
]); ]);
var TypeOfPlatform; var TypeOfPlatform;
(function (TypeOfPlatform) { (function (TypeOfPlatform) {
@ -51,4 +48,4 @@ var TypeOfPlatform;
TypeOfPlatform[TypeOfPlatform["down"] = 2] = "down"; TypeOfPlatform[TypeOfPlatform["down"] = 2] = "down";
})(TypeOfPlatform || (TypeOfPlatform = {})); })(TypeOfPlatform || (TypeOfPlatform = {}));
export { BeiJingConsts, CategoryType, XiAnConsts, platformConstsMap }; export { GPConsts, THConsts, platformConstsMap };

View File

@ -1,6 +1,6 @@
import { GraphicDrawAssistant, GraphicInteractionPlugin, AbsorbableLine } from 'jl-graphic'; import { GraphicDrawAssistant, GraphicInteractionPlugin, AbsorbableLine } from 'jl-graphic';
import { JlPlatform } from './JlPlatform.js'; import { JlPlatform } from './JlPlatform.js';
import { CategoryType } from './PlatformConfig.js'; import { StyleType } from '../../common/common.js';
class PlatformDraw extends GraphicDrawAssistant { class PlatformDraw extends GraphicDrawAssistant {
platformGraphic; platformGraphic;
@ -24,8 +24,8 @@ class PlatformDraw extends GraphicDrawAssistant {
} }
prepareData(data) { prepareData(data) {
const template = this.graphicTemplate; const template = this.graphicTemplate;
switch (template.categoryType) { switch (template.styleType) {
case CategoryType.XiAn: case StyleType.TH:
data.hasdoor = template.hasdoor; data.hasdoor = template.hasdoor;
data.direction = template.direction; data.direction = template.direction;
break; break;

View File

@ -1,12 +1,13 @@
import { JlGraphicTemplate } from 'jl-graphic'; import { JlGraphicTemplate } from 'jl-graphic';
import { JlPlatform } from './JlPlatform'; import { JlPlatform } from './JlPlatform';
import { CategoryType, IPlatformData } from './PlatformConfig'; import { IPlatformData } from './PlatformConfig';
import { IXiAnPlatformState } from './XiAnPlatform'; import { ITHPlatformState } from './THPlatform';
import { IBeiJingPlatformState } from './BeiJingPlatform'; import { IBeiJingPlatformState } from './GPPlatform';
import { StyleType } from 'common/common';
export declare class PlatformTemplate extends JlGraphicTemplate<JlPlatform> { export declare class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
hasdoor?: boolean; hasdoor?: boolean;
direction?: string; direction?: string;
categoryType: CategoryType; styleType: StyleType;
constructor(dataTemplate: IPlatformData, stateTemplate: IXiAnPlatformState | IBeiJingPlatformState, categoryType: CategoryType); constructor(dataTemplate: IPlatformData, stateTemplate: ITHPlatformState | IBeiJingPlatformState, styleType: StyleType);
new(): JlPlatform; new(): JlPlatform;
} }

View File

@ -1,35 +1,35 @@
import { JlGraphicTemplate } from 'jl-graphic'; import { JlGraphicTemplate } from 'jl-graphic';
import { JlPlatform } from './JlPlatform.js'; import { JlPlatform } from './JlPlatform.js';
import { CategoryType } from './PlatformConfig.js'; import { THPlatform } from './THPlatform.js';
import { XiAnPlatform } from './XiAnPlatform.js'; import { GPPlatform } from './GPPlatform.js';
import { BeiJingPlatform } from './BeiJingPlatform.js'; import { StyleType } from '../../common/common.js';
class PlatformTemplate extends JlGraphicTemplate { class PlatformTemplate extends JlGraphicTemplate {
hasdoor; hasdoor;
direction; direction;
categoryType; styleType;
constructor(dataTemplate, stateTemplate, categoryType) { constructor(dataTemplate, stateTemplate, styleType) {
super(JlPlatform.Type, { dataTemplate, stateTemplate }); super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.categoryType = categoryType; this.styleType = styleType;
switch (this.categoryType) { switch (this.styleType) {
case CategoryType.XiAn: case StyleType.TH:
this.hasdoor = true; this.hasdoor = true;
this.direction = 'up'; this.direction = 'up';
break; break;
} }
} }
new() { new() {
switch (this.categoryType) { switch (this.styleType) {
case CategoryType.BeiJing: case StyleType.GP:
const BeiJing = new BeiJingPlatform(); const GP = new GPPlatform();
BeiJing.loadData(this.datas); GP.loadData(this.datas);
BeiJing.loadState(this.states); GP.loadState(this.states);
return BeiJing; return GP;
default: default:
const XiAn = new XiAnPlatform(); const TH = new THPlatform();
XiAn.loadData(this.datas); TH.loadData(this.datas);
XiAn.loadState(this.states); TH.loadState(this.states);
return XiAn; return TH;
} }
} }
} }

View File

@ -1,6 +1,6 @@
import { GraphicState } from 'jl-graphic'; import { GraphicState } from 'jl-graphic';
import { JlPlatform } from './JlPlatform'; import { JlPlatform, DoorCodeLozenge } from './JlPlatform';
export interface IXiAnPlatformState extends GraphicState { export interface ITHPlatformState extends GraphicState {
get emergstop(): boolean; get emergstop(): boolean;
set emergstop(v: boolean); set emergstop(v: boolean);
get trainberth(): boolean; get trainberth(): boolean;
@ -36,8 +36,9 @@ export interface IXiAnPlatformState extends GraphicState {
get rtuId(): number; get rtuId(): number;
set rtuId(v: number); set rtuId(v: number);
} }
export declare class XiAnPlatform extends JlPlatform { export declare class THPlatform extends JlPlatform {
doorCodeLozenge: DoorCodeLozenge;
constructor(); constructor();
get states(): IXiAnPlatformState; get states(): ITHPlatformState;
doRepaint(): void; doRepaint(): void;
} }

View File

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

View File

@ -1,102 +0,0 @@
import { CategoryType, XiAnConsts } from './PlatformConfig.js';
import { JlPlatform } from './JlPlatform.js';
class XiAnPlatform extends JlPlatform {
constructor() {
super(CategoryType.XiAn);
}
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.datas.hasdoor && 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.datas.hasdoor && 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

@ -56,6 +56,11 @@ export declare class Section extends JlGraphic {
} | undefined; } | undefined;
/** 获取拆分逻辑区段数据 */ /** 获取拆分逻辑区段数据 */
getSplitPoints(count: number): IPointData[][]; getSplitPoints(count: number): IPointData[][];
/**
* * Relation处理考虑按不同区段类型分别处理或交子类处理后导出子类
*
*
*/
buildRelation(): void; buildRelation(): void;
saveRelations(): void; saveRelations(): void;
loadRelations(): void; loadRelations(): void;

View File

@ -139,6 +139,12 @@ let Section$1 = class Section extends JlGraphic {
return splitLineEvenly(this.localToCanvasPoint(this.datas.points[0]), this.localToCanvasPoint(this.datas.points[this.datas.points.length - 1]), count); return splitLineEvenly(this.localToCanvasPoint(this.datas.points[0]), this.localToCanvasPoint(this.datas.points[this.datas.points.length - 1]), count);
} }
} }
//TODO
/**
* * Relation处理考虑按不同区段类型分别处理或交子类处理后导出子类
*
*
*/
buildRelation() { buildRelation() {
this.relationManage.deleteRelationOfGraphicAndOtherType(this, Section.Type); this.relationManage.deleteRelationOfGraphicAndOtherType(this, Section.Type);
if (this.datas.sectionType === SectionType.Physical) { if (this.datas.sectionType === SectionType.Physical) {

View File

@ -319,6 +319,11 @@ class SectionPointEditPlugin extends GraphicInteractionPlugin {
clearWaypointsConfig.handler = () => { clearWaypointsConfig.handler = () => {
clearWayPoint(section, false); clearWayPoint(section, false);
}; };
// TODO
/**
* 区段拆分的菜单项和对话框之前写在这里但引用了Quasar组件不是很合适暂时先注释掉
* Section中已有获取拆分的数据的方法考虑将生成对应目标区段的逻辑放业务层或这里提供生成方法供业务层调用
*/
// splitSectionConfig.disabled = false; // splitSectionConfig.disabled = false;
// splitSectionConfig.handler = () => { // splitSectionConfig.handler = () => {
// Dialog.create({ // Dialog.create({

View File

@ -1,10 +0,0 @@
import { GraphicState } from 'jl-graphic';
import { JlStation } from './JlStation';
export interface IBeiJingStationState extends GraphicState {
id: number;
}
export declare class BeiJingStation extends JlStation {
constructor();
get states(): IBeiJingStationState;
doRepaint(): void;
}

View File

@ -0,0 +1,10 @@
import { GraphicState } from 'jl-graphic';
import { JlStation } from './JlStation';
export interface IGPStationState extends GraphicState {
id: number;
}
export declare class GPStation extends JlStation {
constructor();
get states(): IGPStationState;
doRepaint(): void;
}

View File

@ -1,9 +1,9 @@
import { JlStation } from './JlStation.js'; import { JlStation } from './JlStation.js';
import { CategoryType } from '../Platform/PlatformConfig.js'; import { StyleType } from '../../common/common.js';
class BeiJingStation extends JlStation { class GPStation extends JlStation {
constructor() { constructor() {
super(CategoryType.BeiJing); super(StyleType.GP);
} }
get states() { get states() {
return this.getStates(); return this.getStates();
@ -13,4 +13,4 @@ class BeiJingStation extends JlStation {
} }
} }
export { BeiJingStation }; export { GPStation };

View File

@ -1,12 +1,11 @@
import { Container, Point } from 'pixi.js'; import { Container, Point } from 'pixi.js';
import { JlGraphic, VectorText } from 'jl-graphic'; import { JlGraphic, VectorText } from 'jl-graphic';
import { ConstrolConstsConfig, ConstrolItemConfig, IStationData, StationConstsConfig } from './StationConfig'; import { ConstrolConstsConfig, ConstrolItemConfig, IStationData, StationConstsConfig } from './StationConfig';
import { CategoryType } from '../Platform/PlatformConfig'; import { StyleType } from 'common/common';
declare class ConstrolGraphic extends Container { export declare class ConstrolGraphic extends Container {
categoryType: CategoryType;
constrolConfig?: ConstrolItemConfig[]; constrolConfig?: ConstrolItemConfig[];
stateArrowFillColor?: string; stateArrowFillColor?: string;
constructor(categoryType: CategoryType); constructor();
draw(stationConsts: StationConstsConfig): void; draw(stationConsts: StationConstsConfig): void;
drawCircleCode(constrolConsts: ConstrolConstsConfig, code: string, circleFillColor: string, codeGraphFillColor: string, pos: { drawCircleCode(constrolConsts: ConstrolConstsConfig, code: string, circleFillColor: string, codeGraphFillColor: string, pos: {
circlePs: Point; circlePs: Point;
@ -16,14 +15,12 @@ declare class ConstrolGraphic extends Container {
} }
export declare abstract class JlStation extends JlGraphic { export declare abstract class JlStation extends JlGraphic {
static Type: string; static Type: string;
private categoryType; private styleType;
private stationConsts; private stationConsts;
codeGraph: VectorText; codeGraph: VectorText;
kilometerGraph: VectorText; kilometerGraph: VectorText;
controlGraphic?: ConstrolGraphic; constructor(styleType: StyleType);
constructor(categoryType: CategoryType);
get datas(): IStationData; get datas(): IStationData;
get code(): string; get code(): string;
doRepaint(): void; doRepaint(): void;
} }
export {};

View File

@ -1,15 +1,13 @@
import { Container, Point, Graphics, Color } from 'pixi.js'; import { Container, Point, Graphics, Color } from 'pixi.js';
import { JlGraphic, VectorText } from 'jl-graphic'; import { VectorText, JlGraphic } from 'jl-graphic';
import { stationConstsMap } from './StationConfig.js'; import { stationConstsMap } from './StationConfig.js';
import { CategoryType } from '../Platform/PlatformConfig.js'; import { StyleType } from '../../common/common.js';
class ConstrolGraphic extends Container { class ConstrolGraphic extends Container {
categoryType;
constrolConfig; constrolConfig;
stateArrowFillColor; stateArrowFillColor;
constructor(categoryType) { constructor() {
super(); super();
this.categoryType = categoryType;
} }
draw(stationConsts) { draw(stationConsts) {
const constrolConsts = stationConsts.constrolGraphic; const constrolConsts = stationConsts.constrolGraphic;
@ -77,21 +75,16 @@ class ConstrolGraphic extends Container {
} }
class JlStation extends JlGraphic { class JlStation extends JlGraphic {
static Type = 'station'; static Type = 'station';
categoryType; styleType;
stationConsts; stationConsts;
codeGraph = new VectorText(''); //车站名 codeGraph = new VectorText(''); //车站名
kilometerGraph = new VectorText(''); //公里标 kilometerGraph = new VectorText(''); //公里标
controlGraphic; constructor(styleType) {
constructor(categoryType) {
super(JlStation.Type); super(JlStation.Type);
this.categoryType = categoryType; this.styleType = styleType;
this.stationConsts = stationConstsMap.get(this.categoryType); this.stationConsts = stationConstsMap.get(this.styleType);
this.addChild(this.codeGraph); this.addChild(this.codeGraph);
this.addChild(this.kilometerGraph); this.addChild(this.kilometerGraph);
if (this.stationConsts.constrolGraphic) {
this.controlGraphic = new ConstrolGraphic(categoryType);
this.addChild(this.controlGraphic);
}
} }
get datas() { get datas() {
return this.getDatas(); return this.getDatas();
@ -102,15 +95,13 @@ class JlStation extends JlGraphic {
doRepaint() { doRepaint() {
const codeGraph = this.codeGraph; const codeGraph = this.codeGraph;
const kilometerGraph = this.kilometerGraph; const kilometerGraph = this.kilometerGraph;
const controlGraphic = this.controlGraphic; switch (this.styleType) {
controlGraphic?.clear(); case StyleType.TH:
switch (this.categoryType) {
case CategoryType.XiAn:
codeGraph.text = this.datas?.code codeGraph.text = this.datas?.code
? `${this.datas?.name}(${this.datas?.code})` ? `${this.datas?.name}(${this.datas?.code})`
: `${this.datas?.name}`; : `${this.datas?.name}`;
break; break;
case CategoryType.BeiJing: case StyleType.GP:
codeGraph.text = this.datas?.code || '车站Station'; codeGraph.text = this.datas?.code || '车站Station';
break; break;
} }
@ -141,10 +132,7 @@ class JlStation extends JlGraphic {
} }
}); });
} }
if (this.datas.hasControl && this.controlGraphic) {
this.controlGraphic.draw(this.stationConsts);
}
} }
} }
export { JlStation }; export { ConstrolGraphic, JlStation };

View File

@ -1,5 +1,5 @@
import { GraphicData } from 'jl-graphic'; import { GraphicData } from 'jl-graphic';
import { CategoryType } from '../Platform/PlatformConfig'; import { StyleType } from 'common/common';
import { KilometerSystem } from 'common/common'; import { KilometerSystem } from 'common/common';
export interface StationConstsConfig { export interface StationConstsConfig {
codeColor: string; codeColor: string;
@ -28,14 +28,14 @@ export interface InArrowConfig {
inArrowFillColorGray: string; inArrowFillColorGray: string;
inArrowFillColorBlue: string; inArrowFillColorBlue: string;
} }
export declare const BeiJingConsts: { export declare const GPConsts: {
codeColor: string; codeColor: string;
codeFontSize: number; codeFontSize: number;
kilometerCodeColor: string; kilometerCodeColor: string;
kilometerCodeFontSize: number; kilometerCodeFontSize: number;
kilometerCodeOffsetY: number; kilometerCodeOffsetY: number;
}; };
export declare const XiAnConsts: { export declare const THConsts: {
codeColor: string; codeColor: string;
codeFontSize: number; codeFontSize: number;
kilometerCodeColor: string; kilometerCodeColor: string;
@ -79,7 +79,7 @@ export declare const otherConsts: {
}[]; }[];
}; };
}; };
export declare const stationConstsMap: Map<CategoryType, StationConstsConfig>; export declare const stationConstsMap: Map<StyleType, StationConstsConfig>;
export interface IStationData extends GraphicData { export interface IStationData extends GraphicData {
code: string; code: string;
stationName?: string; stationName?: string;

View File

@ -1,13 +1,13 @@
import { CategoryType } from '../Platform/PlatformConfig.js'; import { StyleType } from '../../common/common.js';
const BeiJingConsts = { const GPConsts = {
codeColor: '0xF48815', codeColor: '0xF48815',
codeFontSize: 22, codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF', kilometerCodeColor: '0xFFFFFF',
kilometerCodeFontSize: 8, kilometerCodeFontSize: 8,
kilometerCodeOffsetY: -25, kilometerCodeOffsetY: -25,
}; };
const XiAnConsts = { const THConsts = {
codeColor: '0xF48815', codeColor: '0xF48815',
codeFontSize: 22, codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF', kilometerCodeColor: '0xFFFFFF',
@ -81,8 +81,8 @@ const otherConsts = {
}, },
}; };
const stationConstsMap = new Map([ const stationConstsMap = new Map([
[CategoryType.BeiJing, BeiJingConsts], [StyleType.GP, GPConsts],
[CategoryType.XiAn, XiAnConsts], [StyleType.TH, THConsts],
]); ]);
export { BeiJingConsts, XiAnConsts, otherConsts, stationConstsMap }; export { GPConsts, THConsts, otherConsts, stationConstsMap };

View File

@ -1,6 +1,6 @@
import { GraphicDrawAssistant, GraphicInteractionPlugin, AbsorbableLine } from 'jl-graphic'; import { GraphicDrawAssistant, GraphicInteractionPlugin, AbsorbableLine } from 'jl-graphic';
import { JlStation } from './JlStation.js'; import { JlStation } from './JlStation.js';
import { CategoryType } from '../Platform/PlatformConfig.js'; import { StyleType } from '../../common/common.js';
class StationDraw extends GraphicDrawAssistant { class StationDraw extends GraphicDrawAssistant {
codeGraph; codeGraph;
@ -24,8 +24,8 @@ class StationDraw extends GraphicDrawAssistant {
} }
prepareData(data) { prepareData(data) {
const template = this.graphicTemplate; const template = this.graphicTemplate;
switch (template.categoryType) { switch (template.styleType) {
case CategoryType.XiAn: case StyleType.TH:
data.hasControl = this.graphicTemplate.hasControl; data.hasControl = this.graphicTemplate.hasControl;
break; break;
} }

View File

@ -1,12 +1,12 @@
import { JlGraphicTemplate } from 'jl-graphic'; import { JlGraphicTemplate } from 'jl-graphic';
import { JlStation } from './JlStation'; import { JlStation } from './JlStation';
import { IStationData } from './StationConfig'; import { IStationData } from './StationConfig';
import { IXiAnStationState } from './XiAnStation'; import { ITHStationState } from './THStation';
import { IBeiJingStationState } from './BeiJingStation'; import { IGPStationState } from './GPStation';
import { CategoryType } from '../Platform/PlatformConfig'; import { StyleType } from 'common/common';
export declare class StationTemplate extends JlGraphicTemplate<JlStation> { export declare class StationTemplate extends JlGraphicTemplate<JlStation> {
hasControl?: boolean; hasControl?: boolean;
categoryType: CategoryType; styleType: StyleType;
constructor(dataTemplate: IStationData, stateTemplate: IXiAnStationState | IBeiJingStationState, categoryType: CategoryType); constructor(dataTemplate: IStationData, stateTemplate: ITHStationState | IGPStationState, styleType: StyleType);
new(): JlStation; new(): JlStation;
} }

View File

@ -1,36 +1,36 @@
import { JlGraphicTemplate } from 'jl-graphic'; import { JlGraphicTemplate } from 'jl-graphic';
import { JlStation } from './JlStation.js'; import { JlStation } from './JlStation.js';
import { XiAnStation } from './XiAnStation.js'; import { THStation } from './THStation.js';
import { BeiJingStation } from './BeiJingStation.js'; import { GPStation } from './GPStation.js';
import { CategoryType } from '../Platform/PlatformConfig.js'; import { StyleType } from '../../common/common.js';
class StationTemplate extends JlGraphicTemplate { class StationTemplate extends JlGraphicTemplate {
hasControl; hasControl;
categoryType; styleType;
constructor(dataTemplate, stateTemplate, categoryType) { constructor(dataTemplate, stateTemplate, styleType) {
super(JlStation.Type, { super(JlStation.Type, {
dataTemplate, dataTemplate,
stateTemplate, stateTemplate,
}); });
this.categoryType = categoryType; this.styleType = styleType;
switch (this.categoryType) { switch (this.styleType) {
case CategoryType.XiAn: case StyleType.TH:
this.hasControl = true; this.hasControl = true;
break; break;
} }
} }
new() { new() {
switch (this.categoryType) { switch (this.styleType) {
case CategoryType.BeiJing: case StyleType.GP:
const BeiJing = new BeiJingStation(); const GP = new GPStation();
BeiJing.loadData(this.datas); GP.loadData(this.datas);
BeiJing.loadState(this.states); GP.loadState(this.states);
return BeiJing; return GP;
default: default:
const XiAn = new XiAnStation(); const TH = new THStation();
XiAn.loadData(this.datas); TH.loadData(this.datas);
XiAn.loadState(this.states); TH.loadState(this.states);
return XiAn; return TH;
} }
} }
} }

View File

@ -1,6 +1,6 @@
import { GraphicState } from 'jl-graphic'; import { GraphicState } from 'jl-graphic';
import { JlStation } from './JlStation'; import { ConstrolGraphic, JlStation } from './JlStation';
export interface IXiAnStationState extends GraphicState { export interface ITHStationState extends GraphicState {
get ipRtuStusDown(): boolean; get ipRtuStusDown(): boolean;
set ipRtuStusDown(v: boolean); set ipRtuStusDown(v: boolean);
get ipRtuStusInLocalCtrl(): boolean; get ipRtuStusInLocalCtrl(): boolean;
@ -12,9 +12,10 @@ export interface IXiAnStationState extends GraphicState {
get rtuId(): number; get rtuId(): number;
set rtuId(v: number); set rtuId(v: number);
} }
export declare class XiAnStation extends JlStation { export declare class THStation extends JlStation {
_ipRtuStusDown: boolean; _ipRtuStusDown: boolean;
controlGraphic: ConstrolGraphic;
constructor(); constructor();
get states(): IXiAnStationState; get states(): ITHStationState;
doRepaint(): void; doRepaint(): void;
} }

View File

@ -1,21 +1,25 @@
import { JlStation } from './JlStation.js'; import { JlStation, ConstrolGraphic } from './JlStation.js';
import { CategoryType } from '../Platform/PlatformConfig.js'; import { THConsts } from './StationConfig.js';
import { XiAnConsts } from './StationConfig.js'; import { StyleType } from '../../common/common.js';
class XiAnStation extends JlStation { class THStation extends JlStation {
_ipRtuStusDown = false; _ipRtuStusDown = false;
controlGraphic;
constructor() { constructor() {
super(CategoryType.XiAn); super(StyleType.TH);
this.controlGraphic = new ConstrolGraphic();
this.addChild(this.controlGraphic);
} }
get states() { get states() {
return this.getStates(); return this.getStates();
} }
doRepaint() { doRepaint() {
if (this.datas.hasControl && this.controlGraphic) { this.controlGraphic.clear();
if (this.datas.hasControl) {
this.controlGraphic.constrolConfig = this.controlGraphic.constrolConfig =
XiAnConsts.constrolGraphic.constrolConfig; THConsts.constrolGraphic.constrolConfig;
this.controlGraphic.stateArrowFillColor = this.controlGraphic.stateArrowFillColor =
XiAnConsts.constrolGraphic.inArrowConfig.inArrowFillColorGray; THConsts.constrolGraphic.inArrowConfig.inArrowFillColorGray;
if (this.states.ipRtuStusInLocalCtrl) { if (this.states.ipRtuStusInLocalCtrl) {
this.controlGraphic.constrolConfig.forEach((item) => { this.controlGraphic.constrolConfig.forEach((item) => {
if (item.codeText === '站控') { if (item.codeText === '站控') {
@ -27,9 +31,10 @@ class XiAnStation extends JlStation {
}); });
if (!this.states.ipRtuStusDown) { if (!this.states.ipRtuStusDown) {
this.controlGraphic.stateArrowFillColor == this.controlGraphic.stateArrowFillColor ==
XiAnConsts.constrolGraphic.inArrowConfig.inArrowFillColorBlue; THConsts.constrolGraphic.inArrowConfig.inArrowFillColorBlue;
} }
} }
this.controlGraphic.draw(THConsts);
} }
super.doRepaint(); super.doRepaint();
if (this.states.ipRtuStusDown !== this._ipRtuStusDown) { if (this.states.ipRtuStusDown !== this._ipRtuStusDown) {
@ -39,4 +44,4 @@ class XiAnStation extends JlStation {
} }
} }
export { XiAnStation }; export { THStation };

View File

@ -1,3 +1,12 @@
export enum StyleType {
GP = 'GP', //北京测试: 轨旁 GP
TH = 'TH', //西安NCC/西安1、3号线/福州1号线/标准线/佛山1号线/西安3:通号 TH
KSK = 'KSK', //宁波1号线 卡斯柯
ZDWX = 'ZDWX', //西安2号线/成都1号线 浙大网新
KSSSSK = 'SSS', //南京2号线 十四所
TLZ = 'TLZ', //宁波3号线 泰雷兹
}
export enum DevicePort { export enum DevicePort {
A = 0, A = 0,
B = 1, B = 1,

View File

@ -1,20 +1,20 @@
import { GraphicState } from 'jl-graphic'; import { GraphicState } from 'jl-graphic';
import { CategoryType, BeiJingConsts } from './PlatformConfig'; import { GPConsts } from './PlatformConfig';
import { JlPlatform } from './JlPlatform'; import { JlPlatform } from './JlPlatform';
export interface IBeiJingPlatformState extends GraphicState { export interface IBeiJingPlatformState extends GraphicState {
id?: number; id?: number;
} }
export class BeiJingPlatform extends JlPlatform { export class GPPlatform extends JlPlatform {
constructor() { constructor() {
super(CategoryType.BeiJing); super(GPConsts);
} }
get states(): IBeiJingPlatformState { get states(): IBeiJingPlatformState {
return this.getStates<IBeiJingPlatformState>(); return this.getStates<IBeiJingPlatformState>();
} }
doRepaint(): void { doRepaint(): void {
this.rectGraphic.stateFillColor = BeiJingConsts.noTrainStop; this.rectGraphic.stateFillColor = GPConsts.noTrainStop;
super.doRepaint(); super.draw();
} }
} }

View File

@ -6,7 +6,6 @@ import {
} from 'jl-graphic'; } from 'jl-graphic';
import { Container, Graphics, Rectangle, Color, Point } from 'pixi.js'; import { Container, Graphics, Rectangle, Color, Point } from 'pixi.js';
import { import {
CategoryType,
CodeConstsConfig, CodeConstsConfig,
DoorConstsConfig, DoorConstsConfig,
IPlatformData, IPlatformData,
@ -14,15 +13,14 @@ import {
PlatformConstsConfig, PlatformConstsConfig,
platformConstsMap, platformConstsMap,
} from './PlatformConfig'; } from './PlatformConfig';
import { StyleType } from 'common/common';
//子元素--矩形 //子元素--矩形
class RectGraphic extends Container { class RectGraphic extends Container {
categoryType: CategoryType;
rect: Graphics; rect: Graphics;
stateFillColor?: string; stateFillColor?: string;
constructor(categoryType: CategoryType) { constructor() {
super(); super();
this.categoryType = categoryType;
this.rect = new Graphics(); this.rect = new Graphics();
this.addChild(this.rect); this.addChild(this.rect);
} }
@ -44,13 +42,11 @@ class RectGraphic extends Container {
} }
//子元素--门 //子元素--门
class DoorGraphic extends Container { class DoorGraphic extends Container {
categoryType: CategoryType;
doorGraphic: Graphics; doorGraphic: Graphics;
doorCloseGraphic: Graphics; doorCloseGraphic: Graphics;
stateFillColor?: string; stateFillColor?: string;
constructor(categoryType: CategoryType) { constructor() {
super(); super();
this.categoryType = categoryType;
this.doorGraphic = new Graphics(); this.doorGraphic = new Graphics();
this.doorCloseGraphic = new Graphics(); this.doorCloseGraphic = new Graphics();
this.addChild(this.doorGraphic); this.addChild(this.doorGraphic);
@ -82,18 +78,13 @@ class DoorGraphic extends Container {
} }
//子元素--字符 //子元素--字符
class CodeGraphic extends Container { class CodeGraphic extends Container {
categoryType: CategoryType;
character: VectorText = new VectorText(''); //扣车H character: VectorText = new VectorText(''); //扣车H
runLevel: VectorText = new VectorText(''); //运行等级 runLevel: VectorText = new VectorText(''); //运行等级
runTime: VectorText = new VectorText(''); //运行时间 runTime: VectorText = new VectorText(''); //运行时间
stopTime: VectorText = new VectorText(''); //停站时间 stopTime: VectorText = new VectorText(''); //停站时间
circle: Graphics = new Graphics(); circle: Graphics = new Graphics();
constructor( constructor(platformConsts: PlatformConstsConfig) {
categoryType: CategoryType,
platformConsts: PlatformConstsConfig,
) {
super(); super();
this.categoryType = categoryType;
this.addChild(this.character); this.addChild(this.character);
this.addChild(this.runLevel); this.addChild(this.runLevel);
this.addChild(this.circle); this.addChild(this.circle);
@ -171,11 +162,9 @@ class CodeGraphic extends Container {
} }
//子元素--站台旁菱形图标 //子元素--站台旁菱形图标
class LozengeGraphic extends Container { class LozengeGraphic extends Container {
categoryType: CategoryType;
lozenge: Graphics; lozenge: Graphics;
constructor(categoryType: CategoryType) { constructor() {
super(); super();
this.categoryType = categoryType;
this.lozenge = new Graphics(); this.lozenge = new Graphics();
this.addChild(this.lozenge); this.addChild(this.lozenge);
} }
@ -203,63 +192,54 @@ class LozengeGraphic extends Container {
} }
} }
export abstract class JlPlatform extends JlGraphic { export class DoorCodeLozenge extends Container {
static Type = 'Platform'; private styleType: StyleType;
private categoryType: CategoryType;
private platformConsts: PlatformConstsConfig; private platformConsts: PlatformConstsConfig;
rectGraphic: RectGraphic; doorGraphic: DoorGraphic;
doorGraphic?: DoorGraphic; lozengeGraphic: LozengeGraphic;
lozengeGraphic?: LozengeGraphic; codeGraphic: CodeGraphic;
codeGraphic?: CodeGraphic; constructor(styleType: StyleType) {
constructor(categoryType: CategoryType) { super();
super(JlPlatform.Type); this.styleType = styleType;
this.categoryType = categoryType;
this.platformConsts = platformConstsMap.get( this.platformConsts = platformConstsMap.get(
this.categoryType, this.styleType,
) as PlatformConstsConfig; ) as PlatformConstsConfig;
this.rectGraphic = new RectGraphic(categoryType); this.doorGraphic = new DoorGraphic();
this.addChild(this.rectGraphic);
if (this.platformConsts.doorGraphic) {
this.doorGraphic = new DoorGraphic(categoryType);
this.addChild(this.doorGraphic); this.addChild(this.doorGraphic);
} this.lozengeGraphic = new LozengeGraphic();
if (this.platformConsts.lozengeGraphic) {
this.lozengeGraphic = new LozengeGraphic(categoryType);
this.addChild(this.lozengeGraphic); this.addChild(this.lozengeGraphic);
} this.codeGraphic = new CodeGraphic(this.platformConsts);
if (this.platformConsts.codeGraphic) {
this.codeGraphic = new CodeGraphic(categoryType, this.platformConsts);
this.addChild(this.codeGraphic); this.addChild(this.codeGraphic);
} }
} draw(hasDoor: boolean, direction: string) {
get datas() {
return this.getDatas<IPlatformData>();
}
get code(): string {
return this.datas.code;
}
doRepaint(): void {
this.doorGraphic?.clear();
const platformConsts = this.platformConsts; const platformConsts = this.platformConsts;
this.rectGraphic.draw(platformConsts); this.doorGraphic.clear();
if (this.datas.hasdoor && this.doorGraphic) { if (hasDoor) {
const doorConsts = platformConsts.doorGraphic as DoorConstsConfig; const doorConsts = platformConsts.doorGraphic as DoorConstsConfig;
this.doorGraphic.draw(platformConsts); this.doorGraphic.draw(platformConsts);
this.doorGraphic.position.set( this.doorGraphic.position.set(
0, 0,
-platformConsts.height / 2 - doorConsts.doorPlatformSpacing, -platformConsts.height / 2 - doorConsts.doorPlatformSpacing,
); );
if (this.datas.direction == 'down') {
this.doorGraphic.position.copyFrom(
calculateMirrorPoint(new Point(0, 0), this.doorGraphic.position),
);
} }
}
if (this.codeGraphic) {
const codeConsts = platformConsts.codeGraphic as CodeConstsConfig; const codeConsts = platformConsts.codeGraphic as CodeConstsConfig;
this.codeGraphic.draw(platformConsts); this.codeGraphic.draw(platformConsts);
this.codeGraphic.position.set(0, 0); this.codeGraphic.position.set(0, 0);
if (this.datas.direction == 'down') { const LozengeConsts = platformConsts.lozengeGraphic as LozengeConstsConfig;
this.lozengeGraphic.draw(platformConsts);
this.lozengeGraphic.position.set(
0,
-platformConsts.height / 2 -
LozengeConsts.doorPlatformSpacing -
platformConsts.height / 3,
);
if (direction == 'down') {
this.doorGraphic.position.copyFrom(
calculateMirrorPoint(new Point(0, 0), this.doorGraphic.position),
);
this.lozengeGraphic.position.copyFrom(
calculateMirrorPoint(new Point(0, 0), this.lozengeGraphic.position),
);
const psChange = [ const psChange = [
this.codeGraphic.character, this.codeGraphic.character,
this.codeGraphic.runLevel, this.codeGraphic.runLevel,
@ -281,21 +261,25 @@ export abstract class JlPlatform extends JlGraphic {
); );
} }
} }
if (this.lozengeGraphic) { }
const LozengeConsts =
platformConsts.lozengeGraphic as LozengeConstsConfig; export abstract class JlPlatform extends JlGraphic {
this.lozengeGraphic.draw(platformConsts); static Type = 'Platform';
this.lozengeGraphic.position.set( private platformConsts: PlatformConstsConfig;
0, rectGraphic: RectGraphic;
-platformConsts.height / 2 - constructor(platformConsts: PlatformConstsConfig) {
LozengeConsts.doorPlatformSpacing - super(JlPlatform.Type);
platformConsts.height / 3, this.platformConsts = platformConsts;
); this.rectGraphic = new RectGraphic();
if (this.datas.direction == 'down') { this.addChild(this.rectGraphic);
this.lozengeGraphic.position.copyFrom( }
calculateMirrorPoint(new Point(0, 0), this.lozengeGraphic.position), get datas() {
); return this.getDatas<IPlatformData>();
} }
} get code(): string {
return this.datas.code;
}
draw(): void {
this.rectGraphic.draw(this.platformConsts);
} }
} }

View File

@ -1,10 +1,6 @@
import { StyleType } from 'common/common';
import { GraphicData } from 'jl-graphic'; import { GraphicData } from 'jl-graphic';
export enum CategoryType {
BeiJing = 'BeiJing', //北京
XiAn = 'XiAn', //西安
}
export interface PlatformConstsConfig { export interface PlatformConstsConfig {
width: number; width: number;
height: number; height: number;
@ -41,7 +37,7 @@ export interface LozengeConstsConfig {
doorPlatformSpacing: number; doorPlatformSpacing: number;
} }
export const BeiJingConsts = { export const GPConsts = {
width: 90, width: 90,
height: 20, height: 20,
lineWidth: 3, lineWidth: 3,
@ -50,7 +46,7 @@ export const BeiJingConsts = {
trainJump: '0xC0C0FE', trainJump: '0xC0C0FE',
}; };
export const XiAnConsts = { export const THConsts = {
width: 90, width: 90,
height: 20, height: 20,
lineWidth: 3, lineWidth: 3,
@ -80,9 +76,9 @@ export const XiAnConsts = {
}, },
}; };
export const platformConstsMap = new Map<CategoryType, PlatformConstsConfig>([ export const platformConstsMap = new Map<StyleType, PlatformConstsConfig>([
[CategoryType.BeiJing, BeiJingConsts], [StyleType.GP, GPConsts],
[CategoryType.XiAn, XiAnConsts], [StyleType.TH, THConsts],
]); ]);
enum TypeOfPlatform { enum TypeOfPlatform {

View File

@ -10,7 +10,8 @@ import {
import { JlPlatform } from './JlPlatform'; import { JlPlatform } from './JlPlatform';
import { PlatformTemplate } from './PlatformTemplate'; import { PlatformTemplate } from './PlatformTemplate';
import { CategoryType, IPlatformData } from './PlatformConfig'; import { StyleType } from 'common/common';
import { IPlatformData } from './PlatformConfig';
export class PlatformDraw extends GraphicDrawAssistant< export class PlatformDraw extends GraphicDrawAssistant<
PlatformTemplate, PlatformTemplate,
@ -41,8 +42,8 @@ export class PlatformDraw extends GraphicDrawAssistant<
prepareData(data: IPlatformData): boolean { prepareData(data: IPlatformData): boolean {
const template = this.graphicTemplate; const template = this.graphicTemplate;
switch (template.categoryType) { switch (template.styleType) {
case CategoryType.XiAn: case StyleType.TH:
data.hasdoor = template.hasdoor; data.hasdoor = template.hasdoor;
data.direction = template.direction; data.direction = template.direction;
break; break;

View File

@ -1,39 +1,40 @@
import { JlGraphicTemplate } from 'jl-graphic'; import { JlGraphicTemplate } from 'jl-graphic';
import { JlPlatform } from './JlPlatform'; import { JlPlatform } from './JlPlatform';
import { CategoryType, IPlatformData } from './PlatformConfig'; import { IPlatformData } from './PlatformConfig';
import { IXiAnPlatformState, XiAnPlatform } from './XiAnPlatform'; import { ITHPlatformState, THPlatform } from './THPlatform';
import { BeiJingPlatform, IBeiJingPlatformState } from './BeiJingPlatform'; import { GPPlatform, IBeiJingPlatformState } from './GPPlatform';
import { StyleType } from 'common/common';
export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> { export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
hasdoor?: boolean; hasdoor?: boolean;
direction?: string; direction?: string;
categoryType: CategoryType; styleType: StyleType;
constructor( constructor(
dataTemplate: IPlatformData, dataTemplate: IPlatformData,
stateTemplate: IXiAnPlatformState | IBeiJingPlatformState, stateTemplate: ITHPlatformState | IBeiJingPlatformState,
categoryType: CategoryType, styleType: StyleType,
) { ) {
super(JlPlatform.Type, { dataTemplate, stateTemplate }); super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.categoryType = categoryType; this.styleType = styleType;
switch (this.categoryType) { switch (this.styleType) {
case CategoryType.XiAn: case StyleType.TH:
this.hasdoor = true; this.hasdoor = true;
this.direction = 'up'; this.direction = 'up';
break; break;
} }
} }
new(): JlPlatform { new(): JlPlatform {
switch (this.categoryType) { switch (this.styleType) {
case CategoryType.BeiJing: case StyleType.GP:
const BeiJing = new BeiJingPlatform(); const GP = new GPPlatform();
BeiJing.loadData(this.datas); GP.loadData(this.datas);
BeiJing.loadState(this.states); GP.loadState(this.states);
return BeiJing; return GP;
default: default:
const XiAn = new XiAnPlatform(); const TH = new THPlatform();
XiAn.loadData(this.datas); TH.loadData(this.datas);
XiAn.loadState(this.states); TH.loadState(this.states);
return XiAn; return TH;
} }
} }
} }

View File

@ -0,0 +1,138 @@
import { GraphicState } from 'jl-graphic';
import { THConsts } from './PlatformConfig';
import { JlPlatform, DoorCodeLozenge } from './JlPlatform';
import { StyleType } from 'common/common';
export interface ITHPlatformState 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 class THPlatform extends JlPlatform {
doorCodeLozenge: DoorCodeLozenge;
constructor() {
super(THConsts);
this.doorCodeLozenge = new DoorCodeLozenge(StyleType.TH);
this.addChild(this.doorCodeLozenge);
}
get states(): ITHPlatformState {
return this.getStates<ITHPlatformState>();
}
doRepaint(): void {
this.rectGraphic.stateFillColor = THConsts.noTrainStop;
if (this.states.trainberth) {
this.rectGraphic.stateFillColor = THConsts.trainStop;
}
if (this.states.upSkipstop || this.states.downSkipstop) {
this.rectGraphic.stateFillColor = THConsts.trainJump;
}
/* const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId,
Station.Type
); */
const doorGraphic = this.doorCodeLozenge.doorGraphic;
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
/* if (!!station?.states.ipRtuStusDown) {
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
} */ if (this.states.psdCut) {
doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
}
super.draw();
this.doorCodeLozenge.draw(
this.datas.hasdoor as boolean,
this.datas.direction as string,
);
//门的状态
if (this.datas.hasdoor) {
if (this.states.psdOpen) {
doorGraphic.doorCloseGraphic.visible = false;
} else {
doorGraphic.doorCloseGraphic.visible = true;
}
}
if (this.states.emergstop) {
this.doorCodeLozenge.lozengeGraphic.lozenge.visible = true;
} else {
this.doorCodeLozenge.lozengeGraphic.lozenge.visible = false;
}
//扣车
const codeGraphic = this.doorCodeLozenge.codeGraphic;
if (
this.states.upHold ||
this.states.upOccHold ||
this.states.downHold ||
this.states.downOccHold
) {
codeGraphic.character.text = 'H';
codeGraphic.character.visible = true;
codeGraphic.circle.visible = true;
//上行扣车
if (this.states.upHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharYellow;
}
if (this.states.upOccHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharWhite;
}
if (this.states.upHold && this.states.upOccHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharRed;
}
//下行扣车
if (this.states.downHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharYellow;
}
if (this.states.downOccHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharWhite;
}
if (this.states.downHold && this.states.downOccHold) {
codeGraphic.character.style.fill = THConsts.codeGraphic.HCharRed;
}
}
//运行等级
if (this.states.nextSectionRunLevel) {
codeGraphic.runLevel.visible = false;
codeGraphic.runLevel.text = this.states.nextSectionRunLevel;
}
//运行时间
if (this.states.nextSectionRunTime) {
codeGraphic.runTime.visible = true;
codeGraphic.runTime.text = this.states.nextSectionRunTime;
}
//停站时间
if (this.states.stopTime) {
codeGraphic.stopTime.visible = true;
codeGraphic.stopTime.text = this.states.stopTime;
}
}
}

View File

@ -1,138 +0,0 @@
import { GraphicState } from 'jl-graphic';
import { CategoryType, XiAnConsts } 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 class XiAnPlatform extends JlPlatform {
constructor() {
super(CategoryType.XiAn);
}
get states(): IXiAnPlatformState {
return this.getStates<IXiAnPlatformState>();
}
doRepaint(): void {
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.datas.hasdoor && 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.datas.hasdoor && 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;
}
}
}
}

View File

@ -1,19 +0,0 @@
import { GraphicState } from 'jl-graphic';
import { JlStation } from './JlStation';
import { CategoryType } from '../Platform/PlatformConfig';
export interface IBeiJingStationState extends GraphicState {
id: number;
}
export class BeiJingStation extends JlStation {
constructor() {
super(CategoryType.BeiJing);
}
get states(): IBeiJingStationState {
return this.getStates<IBeiJingStationState>();
}
doRepaint(): void {
super.doRepaint();
}
}

View File

@ -0,0 +1,19 @@
import { GraphicState } from 'jl-graphic';
import { JlStation } from './JlStation';
import { StyleType } from 'common/common';
export interface IGPStationState extends GraphicState {
id: number;
}
export class GPStation extends JlStation {
constructor() {
super(StyleType.GP);
}
get states(): IGPStationState {
return this.getStates<IGPStationState>();
}
doRepaint(): void {
super.doRepaint();
}
}

View File

@ -7,15 +7,13 @@ import {
StationConstsConfig, StationConstsConfig,
stationConstsMap, stationConstsMap,
} from './StationConfig'; } from './StationConfig';
import { CategoryType } from '../Platform/PlatformConfig'; import { StyleType } from 'common/common';
class ConstrolGraphic extends Container { export class ConstrolGraphic extends Container {
categoryType: CategoryType;
constrolConfig?: ConstrolItemConfig[]; constrolConfig?: ConstrolItemConfig[];
stateArrowFillColor?: string; stateArrowFillColor?: string;
constructor(categoryType: CategoryType) { constructor() {
super(); super();
this.categoryType = categoryType;
} }
draw(stationConsts: StationConstsConfig): void { draw(stationConsts: StationConstsConfig): void {
const constrolConsts = const constrolConsts =
@ -97,23 +95,18 @@ class ConstrolGraphic extends Container {
} }
export abstract class JlStation extends JlGraphic { export abstract class JlStation extends JlGraphic {
static Type = 'station'; static Type = 'station';
private categoryType: CategoryType; private styleType: StyleType;
private stationConsts: StationConstsConfig; private stationConsts: StationConstsConfig;
codeGraph: VectorText = new VectorText(''); //车站名 codeGraph: VectorText = new VectorText(''); //车站名
kilometerGraph: VectorText = new VectorText(''); //公里标 kilometerGraph: VectorText = new VectorText(''); //公里标
controlGraphic?: ConstrolGraphic; constructor(styleType: StyleType) {
constructor(categoryType: CategoryType) {
super(JlStation.Type); super(JlStation.Type);
this.categoryType = categoryType; this.styleType = styleType;
this.stationConsts = stationConstsMap.get( this.stationConsts = stationConstsMap.get(
this.categoryType, this.styleType,
) as StationConstsConfig; ) as StationConstsConfig;
this.addChild(this.codeGraph); this.addChild(this.codeGraph);
this.addChild(this.kilometerGraph); this.addChild(this.kilometerGraph);
if (this.stationConsts.constrolGraphic) {
this.controlGraphic = new ConstrolGraphic(categoryType);
this.addChild(this.controlGraphic);
}
} }
get datas(): IStationData { get datas(): IStationData {
@ -126,15 +119,13 @@ export abstract class JlStation extends JlGraphic {
doRepaint(): void { doRepaint(): void {
const codeGraph = this.codeGraph; const codeGraph = this.codeGraph;
const kilometerGraph = this.kilometerGraph; const kilometerGraph = this.kilometerGraph;
const controlGraphic = this.controlGraphic; switch (this.styleType) {
controlGraphic?.clear(); case StyleType.TH:
switch (this.categoryType) {
case CategoryType.XiAn:
codeGraph.text = this.datas?.code codeGraph.text = this.datas?.code
? `${this.datas?.name}(${this.datas?.code})` ? `${this.datas?.name}(${this.datas?.code})`
: `${this.datas?.name}`; : `${this.datas?.name}`;
break; break;
case CategoryType.BeiJing: case StyleType.GP:
codeGraph.text = this.datas?.code || '车站Station'; codeGraph.text = this.datas?.code || '车站Station';
break; break;
} }
@ -166,8 +157,5 @@ export abstract class JlStation extends JlGraphic {
} }
}); });
} }
if (this.datas.hasControl && this.controlGraphic) {
this.controlGraphic.draw(this.stationConsts);
}
} }
} }

View File

@ -1,6 +1,6 @@
import { GraphicData } from 'jl-graphic'; import { GraphicData } from 'jl-graphic';
import { CategoryType } from '../Platform/PlatformConfig'; import { StyleType } from 'common/common';
import { IRelatedRef, KilometerSystem } from 'common/common'; import { KilometerSystem } from 'common/common';
export interface StationConstsConfig { export interface StationConstsConfig {
codeColor: string; codeColor: string;
@ -33,7 +33,7 @@ export interface InArrowConfig {
inArrowFillColorBlue: string; inArrowFillColorBlue: string;
} }
export const BeiJingConsts = { export const GPConsts = {
codeColor: '0xF48815', codeColor: '0xF48815',
codeFontSize: 22, codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF', kilometerCodeColor: '0xFFFFFF',
@ -41,7 +41,7 @@ export const BeiJingConsts = {
kilometerCodeOffsetY: -25, kilometerCodeOffsetY: -25,
}; };
export const XiAnConsts = { export const THConsts = {
codeColor: '0xF48815', codeColor: '0xF48815',
codeFontSize: 22, codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF', kilometerCodeColor: '0xFFFFFF',
@ -116,9 +116,9 @@ export const otherConsts = {
}, },
}; };
export const stationConstsMap = new Map<CategoryType, StationConstsConfig>([ export const stationConstsMap = new Map<StyleType, StationConstsConfig>([
[CategoryType.BeiJing, BeiJingConsts], [StyleType.GP, GPConsts],
[CategoryType.XiAn, XiAnConsts], [StyleType.TH, THConsts],
]); ]);
export interface IStationData extends GraphicData { export interface IStationData extends GraphicData {

View File

@ -10,7 +10,7 @@ import {
import { JlStation } from './JlStation'; import { JlStation } from './JlStation';
import { IStationData } from './StationConfig'; import { IStationData } from './StationConfig';
import { StationTemplate } from './StationTemplate'; import { StationTemplate } from './StationTemplate';
import { CategoryType } from '../Platform/PlatformConfig'; import { StyleType } from 'common/common';
export class StationDraw extends GraphicDrawAssistant< export class StationDraw extends GraphicDrawAssistant<
StationTemplate, StationTemplate,
@ -41,8 +41,8 @@ export class StationDraw extends GraphicDrawAssistant<
prepareData(data: IStationData): boolean { prepareData(data: IStationData): boolean {
const template = this.graphicTemplate; const template = this.graphicTemplate;
switch (template.categoryType) { switch (template.styleType) {
case CategoryType.XiAn: case StyleType.TH:
data.hasControl = this.graphicTemplate.hasControl; data.hasControl = this.graphicTemplate.hasControl;
break; break;
} }

View File

@ -1,41 +1,41 @@
import { JlGraphicTemplate } from 'jl-graphic'; import { JlGraphicTemplate } from 'jl-graphic';
import { JlStation } from './JlStation'; import { JlStation } from './JlStation';
import { IStationData } from './StationConfig'; import { IStationData } from './StationConfig';
import { IXiAnStationState, XiAnStation } from './XiAnStation'; import { THStation, ITHStationState } from './THStation';
import { BeiJingStation, IBeiJingStationState } from './BeiJingStation'; import { GPStation, IGPStationState } from './GPStation';
import { CategoryType } from '../Platform/PlatformConfig'; import { StyleType } from 'common/common';
export class StationTemplate extends JlGraphicTemplate<JlStation> { export class StationTemplate extends JlGraphicTemplate<JlStation> {
hasControl?: boolean; hasControl?: boolean;
categoryType: CategoryType; styleType: StyleType;
constructor( constructor(
dataTemplate: IStationData, dataTemplate: IStationData,
stateTemplate: IXiAnStationState | IBeiJingStationState, stateTemplate: ITHStationState | IGPStationState,
categoryType: CategoryType, styleType: StyleType,
) { ) {
super(JlStation.Type, { super(JlStation.Type, {
dataTemplate, dataTemplate,
stateTemplate, stateTemplate,
}); });
this.categoryType = categoryType; this.styleType = styleType;
switch (this.categoryType) { switch (this.styleType) {
case CategoryType.XiAn: case StyleType.TH:
this.hasControl = true; this.hasControl = true;
break; break;
} }
} }
new(): JlStation { new(): JlStation {
switch (this.categoryType) { switch (this.styleType) {
case CategoryType.BeiJing: case StyleType.GP:
const BeiJing = new BeiJingStation(); const GP = new GPStation();
BeiJing.loadData(this.datas); GP.loadData(this.datas);
BeiJing.loadState(this.states); GP.loadState(this.states);
return BeiJing; return GP;
default: default:
const XiAn = new XiAnStation(); const TH = new THStation();
XiAn.loadData(this.datas); TH.loadData(this.datas);
XiAn.loadState(this.states); TH.loadState(this.states);
return XiAn; return TH;
} }
} }
} }

View File

@ -1,9 +1,9 @@
import { GraphicState } from 'jl-graphic'; import { GraphicState } from 'jl-graphic';
import { JlStation } from './JlStation'; import { ConstrolGraphic, JlStation } from './JlStation';
import { CategoryType } from '../Platform/PlatformConfig'; import { THConsts } from './StationConfig';
import { XiAnConsts } from './StationConfig'; import { StyleType } from 'common/common';
export interface IXiAnStationState extends GraphicState { export interface ITHStationState extends GraphicState {
get ipRtuStusDown(): boolean; //通信终端---是否允许转到中控 get ipRtuStusDown(): boolean; //通信终端---是否允许转到中控
set ipRtuStusDown(v: boolean); set ipRtuStusDown(v: boolean);
get ipRtuStusInLocalCtrl(): boolean; //站控 get ipRtuStusInLocalCtrl(): boolean; //站控
@ -16,20 +16,24 @@ export interface IXiAnStationState extends GraphicState {
set rtuId(v: number); set rtuId(v: number);
} }
export class XiAnStation extends JlStation { export class THStation extends JlStation {
_ipRtuStusDown = false; _ipRtuStusDown = false;
controlGraphic: ConstrolGraphic;
constructor() { constructor() {
super(CategoryType.XiAn); super(StyleType.TH);
this.controlGraphic = new ConstrolGraphic();
this.addChild(this.controlGraphic);
} }
get states(): IXiAnStationState { get states(): ITHStationState {
return this.getStates<IXiAnStationState>(); return this.getStates<ITHStationState>();
} }
doRepaint(): void { doRepaint(): void {
if (this.datas.hasControl && this.controlGraphic) { this.controlGraphic.clear();
if (this.datas.hasControl) {
this.controlGraphic.constrolConfig = this.controlGraphic.constrolConfig =
XiAnConsts.constrolGraphic.constrolConfig; THConsts.constrolGraphic.constrolConfig;
this.controlGraphic.stateArrowFillColor = this.controlGraphic.stateArrowFillColor =
XiAnConsts.constrolGraphic.inArrowConfig.inArrowFillColorGray; THConsts.constrolGraphic.inArrowConfig.inArrowFillColorGray;
if (this.states.ipRtuStusInLocalCtrl) { if (this.states.ipRtuStusInLocalCtrl) {
this.controlGraphic.constrolConfig.forEach((item) => { this.controlGraphic.constrolConfig.forEach((item) => {
if (item.codeText === '站控') { if (item.codeText === '站控') {
@ -40,11 +44,13 @@ export class XiAnStation extends JlStation {
}); });
if (!this.states.ipRtuStusDown) { if (!this.states.ipRtuStusDown) {
this.controlGraphic.stateArrowFillColor == this.controlGraphic.stateArrowFillColor ==
XiAnConsts.constrolGraphic.inArrowConfig.inArrowFillColorBlue; THConsts.constrolGraphic.inArrowConfig.inArrowFillColorBlue;
} }
} }
this.controlGraphic.draw(THConsts);
} }
super.doRepaint(); super.doRepaint();
if (this.states.ipRtuStusDown !== this._ipRtuStusDown) { if (this.states.ipRtuStusDown !== this._ipRtuStusDown) {
this._ipRtuStusDown = this.states.ipRtuStusDown; this._ipRtuStusDown = this.states.ipRtuStusDown;
//this.handleBlueShow(); //this.handleBlueShow();