站台车站初提交

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 {
A = 0,
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;
(function (DevicePort) {
DevicePort[DevicePort["A"] = 0] = "A";
@ -38,4 +47,4 @@ var IRelatedRef;
IRelatedRef.create = create;
})(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 {
id?: number;
}
export declare class BeiJingPlatform extends JlPlatform {
export declare class GPPlatform extends JlPlatform {
constructor();
get states(): IBeiJingPlatformState;
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 { 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 {
categoryType: CategoryType;
rect: Graphics;
stateFillColor?: string;
constructor(categoryType: CategoryType);
constructor();
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
}
declare class DoorGraphic extends Container {
categoryType: CategoryType;
doorGraphic: Graphics;
doorCloseGraphic: Graphics;
stateFillColor?: string;
constructor(categoryType: CategoryType);
constructor();
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);
constructor(platformConsts: PlatformConstsConfig);
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
}
declare class LozengeGraphic extends Container {
categoryType: CategoryType;
lozenge: Graphics;
constructor(categoryType: CategoryType);
constructor();
draw(platformConsts: PlatformConstsConfig): 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 {
static Type: string;
private categoryType;
private platformConsts;
rectGraphic: RectGraphic;
doorGraphic?: DoorGraphic;
lozengeGraphic?: LozengeGraphic;
codeGraphic?: CodeGraphic;
constructor(categoryType: CategoryType);
constructor(platformConsts: PlatformConstsConfig);
get datas(): IPlatformData;
get code(): string;
doRepaint(): void;
draw(): void;
}
export {};

View File

@ -1,15 +1,13 @@
import { JlGraphic, calculateMirrorPoint, getRectangleCenter, VectorText } from 'jl-graphic';
import { Point, Container, Graphics, Color, Rectangle } from 'pixi.js';
import { calculateMirrorPoint, JlGraphic, getRectangleCenter, VectorText } from 'jl-graphic';
import { Container, Point, Graphics, Color, Rectangle } from 'pixi.js';
import { platformConstsMap } from './PlatformConfig.js';
//子元素--矩形
class RectGraphic extends Container {
categoryType;
rect;
stateFillColor;
constructor(categoryType) {
constructor() {
super();
this.categoryType = categoryType;
this.rect = new Graphics();
this.addChild(this.rect);
}
@ -29,13 +27,11 @@ class RectGraphic extends Container {
}
//子元素--门
class DoorGraphic extends Container {
categoryType;
doorGraphic;
doorCloseGraphic;
stateFillColor;
constructor(categoryType) {
constructor() {
super();
this.categoryType = categoryType;
this.doorGraphic = new Graphics();
this.doorCloseGraphic = new Graphics();
this.addChild(this.doorGraphic);
@ -67,15 +63,13 @@ class DoorGraphic extends Container {
}
//子元素--字符
class CodeGraphic extends Container {
categoryType;
character = new VectorText(''); //扣车H
runLevel = new VectorText(''); //运行等级
runTime = new VectorText(''); //运行时间
stopTime = new VectorText(''); //停站时间
circle = new Graphics();
constructor(categoryType, platformConsts) {
constructor(platformConsts) {
super();
this.categoryType = categoryType;
this.addChild(this.character);
this.addChild(this.runLevel);
this.addChild(this.circle);
@ -138,11 +132,9 @@ class CodeGraphic extends Container {
}
//子元素--站台旁菱形图标
class LozengeGraphic extends Container {
categoryType;
lozenge;
constructor(categoryType) {
constructor() {
super();
this.categoryType = categoryType;
this.lozenge = new Graphics();
this.addChild(this.lozenge);
}
@ -164,56 +156,42 @@ class LozengeGraphic extends Container {
this.lozenge.clear();
}
}
class JlPlatform extends JlGraphic {
static Type = 'Platform';
categoryType;
class DoorCodeLozenge extends Container {
styleType;
platformConsts;
rectGraphic;
doorGraphic;
lozengeGraphic;
codeGraphic;
constructor(categoryType) {
super(JlPlatform.Type);
this.categoryType = categoryType;
this.platformConsts = platformConstsMap.get(this.categoryType);
this.rectGraphic = new RectGraphic(categoryType);
this.addChild(this.rectGraphic);
if (this.platformConsts.doorGraphic) {
this.doorGraphic = new DoorGraphic(categoryType);
constructor(styleType) {
super();
this.styleType = styleType;
this.platformConsts = platformConstsMap.get(this.styleType);
this.doorGraphic = new DoorGraphic();
this.addChild(this.doorGraphic);
}
if (this.platformConsts.lozengeGraphic) {
this.lozengeGraphic = new LozengeGraphic(categoryType);
this.lozengeGraphic = new LozengeGraphic();
this.addChild(this.lozengeGraphic);
}
if (this.platformConsts.codeGraphic) {
this.codeGraphic = new CodeGraphic(categoryType, this.platformConsts);
this.codeGraphic = new CodeGraphic(this.platformConsts);
this.addChild(this.codeGraphic);
}
}
get datas() {
return this.getDatas();
}
get code() {
return this.datas.code;
}
doRepaint() {
this.doorGraphic?.clear();
draw(hasDoor, direction) {
const platformConsts = this.platformConsts;
this.rectGraphic.draw(platformConsts);
if (this.datas.hasdoor && this.doorGraphic) {
this.doorGraphic.clear();
if (hasDoor) {
const doorConsts = platformConsts.doorGraphic;
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.codeGraphic) {
const codeConsts = platformConsts.codeGraphic;
this.codeGraphic.draw(platformConsts);
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 = [
this.codeGraphic.character,
this.codeGraphic.runLevel,
@ -230,17 +208,26 @@ class JlPlatform extends JlGraphic {
(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';
export declare enum CategoryType {
BeiJing = "BeiJing",//北京
XiAn = "XiAn"
}
export interface PlatformConstsConfig {
width: number;
height: number;
@ -35,7 +32,7 @@ export interface LozengeConstsConfig {
lozengeRed: string;
doorPlatformSpacing: number;
}
export declare const BeiJingConsts: {
export declare const GPConsts: {
width: number;
height: number;
lineWidth: number;
@ -43,7 +40,7 @@ export declare const BeiJingConsts: {
trainStop: string;
trainJump: string;
};
export declare const XiAnConsts: {
export declare const THConsts: {
width: number;
height: number;
lineWidth: number;
@ -72,7 +69,7 @@ export declare const XiAnConsts: {
doorPlatformSpacing: number;
};
};
export declare const platformConstsMap: Map<CategoryType, PlatformConstsConfig>;
export declare const platformConstsMap: Map<StyleType, PlatformConstsConfig>;
declare enum TypeOfPlatform {
Unknown = 0,
up = 1,

View File

@ -1,9 +1,6 @@
var CategoryType;
(function (CategoryType) {
CategoryType["BeiJing"] = "BeiJing";
CategoryType["XiAn"] = "XiAn";
})(CategoryType || (CategoryType = {}));
const BeiJingConsts = {
import { StyleType } from '../../common/common.js';
const GPConsts = {
width: 90,
height: 20,
lineWidth: 3,
@ -11,7 +8,7 @@ const BeiJingConsts = {
trainStop: '0xfbff00',
trainJump: '0xC0C0FE',
};
const XiAnConsts = {
const THConsts = {
width: 90,
height: 20,
lineWidth: 3,
@ -41,8 +38,8 @@ const XiAnConsts = {
},
};
const platformConstsMap = new Map([
[CategoryType.BeiJing, BeiJingConsts],
[CategoryType.XiAn, XiAnConsts],
[StyleType.GP, GPConsts],
[StyleType.TH, THConsts],
]);
var TypeOfPlatform;
(function (TypeOfPlatform) {
@ -51,4 +48,4 @@ var TypeOfPlatform;
TypeOfPlatform[TypeOfPlatform["down"] = 2] = "down";
})(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 { JlPlatform } from './JlPlatform.js';
import { CategoryType } from './PlatformConfig.js';
import { StyleType } from '../../common/common.js';
class PlatformDraw extends GraphicDrawAssistant {
platformGraphic;
@ -24,8 +24,8 @@ class PlatformDraw extends GraphicDrawAssistant {
}
prepareData(data) {
const template = this.graphicTemplate;
switch (template.categoryType) {
case CategoryType.XiAn:
switch (template.styleType) {
case StyleType.TH:
data.hasdoor = template.hasdoor;
data.direction = template.direction;
break;

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import { GraphicState } from 'jl-graphic';
import { JlPlatform } from './JlPlatform';
export interface IXiAnPlatformState extends GraphicState {
import { JlPlatform, DoorCodeLozenge } from './JlPlatform';
export interface ITHPlatformState extends GraphicState {
get emergstop(): boolean;
set emergstop(v: boolean);
get trainberth(): boolean;
@ -36,8 +36,9 @@ export interface IXiAnPlatformState extends GraphicState {
get rtuId(): number;
set rtuId(v: number);
}
export declare class XiAnPlatform extends JlPlatform {
export declare class THPlatform extends JlPlatform {
doorCodeLozenge: DoorCodeLozenge;
constructor();
get states(): IXiAnPlatformState;
get states(): ITHPlatformState;
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;
/** 获取拆分逻辑区段数据 */
getSplitPoints(count: number): IPointData[][];
/**
* * Relation处理考虑按不同区段类型分别处理或交子类处理后导出子类
*
*
*/
buildRelation(): void;
saveRelations(): 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);
}
}
//TODO
/**
* * Relation处理考虑按不同区段类型分别处理或交子类处理后导出子类
*
*
*/
buildRelation() {
this.relationManage.deleteRelationOfGraphicAndOtherType(this, Section.Type);
if (this.datas.sectionType === SectionType.Physical) {

View File

@ -319,6 +319,11 @@ class SectionPointEditPlugin extends GraphicInteractionPlugin {
clearWaypointsConfig.handler = () => {
clearWayPoint(section, false);
};
// TODO
/**
* 区段拆分的菜单项和对话框之前写在这里但引用了Quasar组件不是很合适暂时先注释掉
* Section中已有获取拆分的数据的方法考虑将生成对应目标区段的逻辑放业务层或这里提供生成方法供业务层调用
*/
// splitSectionConfig.disabled = false;
// splitSectionConfig.handler = () => {
// 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 { CategoryType } from '../Platform/PlatformConfig.js';
import { StyleType } from '../../common/common.js';
class BeiJingStation extends JlStation {
class GPStation extends JlStation {
constructor() {
super(CategoryType.BeiJing);
super(StyleType.GP);
}
get states() {
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 { JlGraphic, VectorText } from 'jl-graphic';
import { ConstrolConstsConfig, ConstrolItemConfig, IStationData, StationConstsConfig } from './StationConfig';
import { CategoryType } from '../Platform/PlatformConfig';
declare class ConstrolGraphic extends Container {
categoryType: CategoryType;
import { StyleType } from 'common/common';
export declare class ConstrolGraphic extends Container {
constrolConfig?: ConstrolItemConfig[];
stateArrowFillColor?: string;
constructor(categoryType: CategoryType);
constructor();
draw(stationConsts: StationConstsConfig): void;
drawCircleCode(constrolConsts: ConstrolConstsConfig, code: string, circleFillColor: string, codeGraphFillColor: string, pos: {
circlePs: Point;
@ -16,14 +15,12 @@ declare class ConstrolGraphic extends Container {
}
export declare abstract class JlStation extends JlGraphic {
static Type: string;
private categoryType;
private styleType;
private stationConsts;
codeGraph: VectorText;
kilometerGraph: VectorText;
controlGraphic?: ConstrolGraphic;
constructor(categoryType: CategoryType);
constructor(styleType: StyleType);
get datas(): IStationData;
get code(): string;
doRepaint(): void;
}
export {};

View File

@ -1,15 +1,13 @@
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 { CategoryType } from '../Platform/PlatformConfig.js';
import { StyleType } from '../../common/common.js';
class ConstrolGraphic extends Container {
categoryType;
constrolConfig;
stateArrowFillColor;
constructor(categoryType) {
constructor() {
super();
this.categoryType = categoryType;
}
draw(stationConsts) {
const constrolConsts = stationConsts.constrolGraphic;
@ -77,21 +75,16 @@ class ConstrolGraphic extends Container {
}
class JlStation extends JlGraphic {
static Type = 'station';
categoryType;
styleType;
stationConsts;
codeGraph = new VectorText(''); //车站名
kilometerGraph = new VectorText(''); //公里标
controlGraphic;
constructor(categoryType) {
constructor(styleType) {
super(JlStation.Type);
this.categoryType = categoryType;
this.stationConsts = stationConstsMap.get(this.categoryType);
this.styleType = styleType;
this.stationConsts = stationConstsMap.get(this.styleType);
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();
@ -102,15 +95,13 @@ class JlStation extends JlGraphic {
doRepaint() {
const codeGraph = this.codeGraph;
const kilometerGraph = this.kilometerGraph;
const controlGraphic = this.controlGraphic;
controlGraphic?.clear();
switch (this.categoryType) {
case CategoryType.XiAn:
switch (this.styleType) {
case StyleType.TH:
codeGraph.text = this.datas?.code
? `${this.datas?.name}(${this.datas?.code})`
: `${this.datas?.name}`;
break;
case CategoryType.BeiJing:
case StyleType.GP:
codeGraph.text = this.datas?.code || '车站Station';
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 { CategoryType } from '../Platform/PlatformConfig';
import { StyleType } from 'common/common';
import { KilometerSystem } from 'common/common';
export interface StationConstsConfig {
codeColor: string;
@ -28,14 +28,14 @@ export interface InArrowConfig {
inArrowFillColorGray: string;
inArrowFillColorBlue: string;
}
export declare const BeiJingConsts: {
export declare const GPConsts: {
codeColor: string;
codeFontSize: number;
kilometerCodeColor: string;
kilometerCodeFontSize: number;
kilometerCodeOffsetY: number;
};
export declare const XiAnConsts: {
export declare const THConsts: {
codeColor: string;
codeFontSize: number;
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 {
code: 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',
codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF',
kilometerCodeFontSize: 8,
kilometerCodeOffsetY: -25,
};
const XiAnConsts = {
const THConsts = {
codeColor: '0xF48815',
codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF',
@ -81,8 +81,8 @@ const otherConsts = {
},
};
const stationConstsMap = new Map([
[CategoryType.BeiJing, BeiJingConsts],
[CategoryType.XiAn, XiAnConsts],
[StyleType.GP, GPConsts],
[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 { JlStation } from './JlStation.js';
import { CategoryType } from '../Platform/PlatformConfig.js';
import { StyleType } from '../../common/common.js';
class StationDraw extends GraphicDrawAssistant {
codeGraph;
@ -24,8 +24,8 @@ class StationDraw extends GraphicDrawAssistant {
}
prepareData(data) {
const template = this.graphicTemplate;
switch (template.categoryType) {
case CategoryType.XiAn:
switch (template.styleType) {
case StyleType.TH:
data.hasControl = this.graphicTemplate.hasControl;
break;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,6 @@ import {
} from 'jl-graphic';
import { Container, Graphics, Rectangle, Color, Point } from 'pixi.js';
import {
CategoryType,
CodeConstsConfig,
DoorConstsConfig,
IPlatformData,
@ -14,15 +13,14 @@ import {
PlatformConstsConfig,
platformConstsMap,
} from './PlatformConfig';
import { StyleType } from 'common/common';
//子元素--矩形
class RectGraphic extends Container {
categoryType: CategoryType;
rect: Graphics;
stateFillColor?: string;
constructor(categoryType: CategoryType) {
constructor() {
super();
this.categoryType = categoryType;
this.rect = new Graphics();
this.addChild(this.rect);
}
@ -44,13 +42,11 @@ class RectGraphic extends Container {
}
//子元素--门
class DoorGraphic extends Container {
categoryType: CategoryType;
doorGraphic: Graphics;
doorCloseGraphic: Graphics;
stateFillColor?: string;
constructor(categoryType: CategoryType) {
constructor() {
super();
this.categoryType = categoryType;
this.doorGraphic = new Graphics();
this.doorCloseGraphic = new Graphics();
this.addChild(this.doorGraphic);
@ -82,18 +78,13 @@ class DoorGraphic extends Container {
}
//子元素--字符
class CodeGraphic extends Container {
categoryType: CategoryType;
character: VectorText = new VectorText(''); //扣车H
runLevel: VectorText = new VectorText(''); //运行等级
runTime: VectorText = new VectorText(''); //运行时间
stopTime: VectorText = new VectorText(''); //停站时间
circle: Graphics = new Graphics();
constructor(
categoryType: CategoryType,
platformConsts: PlatformConstsConfig,
) {
constructor(platformConsts: PlatformConstsConfig) {
super();
this.categoryType = categoryType;
this.addChild(this.character);
this.addChild(this.runLevel);
this.addChild(this.circle);
@ -171,11 +162,9 @@ class CodeGraphic extends Container {
}
//子元素--站台旁菱形图标
class LozengeGraphic extends Container {
categoryType: CategoryType;
lozenge: Graphics;
constructor(categoryType: CategoryType) {
constructor() {
super();
this.categoryType = categoryType;
this.lozenge = new Graphics();
this.addChild(this.lozenge);
}
@ -203,63 +192,54 @@ class LozengeGraphic extends Container {
}
}
export abstract class JlPlatform extends JlGraphic {
static Type = 'Platform';
private categoryType: CategoryType;
export class DoorCodeLozenge extends Container {
private styleType: StyleType;
private platformConsts: PlatformConstsConfig;
rectGraphic: RectGraphic;
doorGraphic?: DoorGraphic;
lozengeGraphic?: LozengeGraphic;
codeGraphic?: CodeGraphic;
constructor(categoryType: CategoryType) {
super(JlPlatform.Type);
this.categoryType = categoryType;
doorGraphic: DoorGraphic;
lozengeGraphic: LozengeGraphic;
codeGraphic: CodeGraphic;
constructor(styleType: StyleType) {
super();
this.styleType = styleType;
this.platformConsts = platformConstsMap.get(
this.categoryType,
this.styleType,
) as PlatformConstsConfig;
this.rectGraphic = new RectGraphic(categoryType);
this.addChild(this.rectGraphic);
if (this.platformConsts.doorGraphic) {
this.doorGraphic = new DoorGraphic(categoryType);
this.doorGraphic = new DoorGraphic();
this.addChild(this.doorGraphic);
}
if (this.platformConsts.lozengeGraphic) {
this.lozengeGraphic = new LozengeGraphic(categoryType);
this.lozengeGraphic = new LozengeGraphic();
this.addChild(this.lozengeGraphic);
}
if (this.platformConsts.codeGraphic) {
this.codeGraphic = new CodeGraphic(categoryType, this.platformConsts);
this.codeGraphic = new CodeGraphic(this.platformConsts);
this.addChild(this.codeGraphic);
}
}
get datas() {
return this.getDatas<IPlatformData>();
}
get code(): string {
return this.datas.code;
}
doRepaint(): void {
this.doorGraphic?.clear();
draw(hasDoor: boolean, direction: string) {
const platformConsts = this.platformConsts;
this.rectGraphic.draw(platformConsts);
if (this.datas.hasdoor && this.doorGraphic) {
this.doorGraphic.clear();
if (hasDoor) {
const doorConsts = platformConsts.doorGraphic as DoorConstsConfig;
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.codeGraphic) {
const codeConsts = platformConsts.codeGraphic as CodeConstsConfig;
this.codeGraphic.draw(platformConsts);
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 = [
this.codeGraphic.character,
this.codeGraphic.runLevel,
@ -281,21 +261,25 @@ export abstract class JlPlatform extends JlGraphic {
);
}
}
if (this.lozengeGraphic) {
const LozengeConsts =
platformConsts.lozengeGraphic as LozengeConstsConfig;
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),
);
}
export abstract class JlPlatform extends JlGraphic {
static Type = 'Platform';
private platformConsts: PlatformConstsConfig;
rectGraphic: RectGraphic;
constructor(platformConsts: PlatformConstsConfig) {
super(JlPlatform.Type);
this.platformConsts = platformConsts;
this.rectGraphic = new RectGraphic();
this.addChild(this.rectGraphic);
}
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';
export enum CategoryType {
BeiJing = 'BeiJing', //北京
XiAn = 'XiAn', //西安
}
export interface PlatformConstsConfig {
width: number;
height: number;
@ -41,7 +37,7 @@ export interface LozengeConstsConfig {
doorPlatformSpacing: number;
}
export const BeiJingConsts = {
export const GPConsts = {
width: 90,
height: 20,
lineWidth: 3,
@ -50,7 +46,7 @@ export const BeiJingConsts = {
trainJump: '0xC0C0FE',
};
export const XiAnConsts = {
export const THConsts = {
width: 90,
height: 20,
lineWidth: 3,
@ -80,9 +76,9 @@ export const XiAnConsts = {
},
};
export const platformConstsMap = new Map<CategoryType, PlatformConstsConfig>([
[CategoryType.BeiJing, BeiJingConsts],
[CategoryType.XiAn, XiAnConsts],
export const platformConstsMap = new Map<StyleType, PlatformConstsConfig>([
[StyleType.GP, GPConsts],
[StyleType.TH, THConsts],
]);
enum TypeOfPlatform {

View File

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

View File

@ -1,39 +1,40 @@
import { JlGraphicTemplate } from 'jl-graphic';
import { JlPlatform } from './JlPlatform';
import { CategoryType, IPlatformData } from './PlatformConfig';
import { IXiAnPlatformState, XiAnPlatform } from './XiAnPlatform';
import { BeiJingPlatform, IBeiJingPlatformState } from './BeiJingPlatform';
import { IPlatformData } from './PlatformConfig';
import { ITHPlatformState, THPlatform } from './THPlatform';
import { GPPlatform, IBeiJingPlatformState } from './GPPlatform';
import { StyleType } from 'common/common';
export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
hasdoor?: boolean;
direction?: string;
categoryType: CategoryType;
styleType: StyleType;
constructor(
dataTemplate: IPlatformData,
stateTemplate: IXiAnPlatformState | IBeiJingPlatformState,
categoryType: CategoryType,
stateTemplate: ITHPlatformState | IBeiJingPlatformState,
styleType: StyleType,
) {
super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.categoryType = categoryType;
switch (this.categoryType) {
case CategoryType.XiAn:
this.styleType = styleType;
switch (this.styleType) {
case StyleType.TH:
this.hasdoor = true;
this.direction = 'up';
break;
}
}
new(): JlPlatform {
switch (this.categoryType) {
case CategoryType.BeiJing:
const BeiJing = new BeiJingPlatform();
BeiJing.loadData(this.datas);
BeiJing.loadState(this.states);
return BeiJing;
switch (this.styleType) {
case StyleType.GP:
const GP = new GPPlatform();
GP.loadData(this.datas);
GP.loadState(this.states);
return GP;
default:
const XiAn = new XiAnPlatform();
XiAn.loadData(this.datas);
XiAn.loadState(this.states);
return XiAn;
const TH = new THPlatform();
TH.loadData(this.datas);
TH.loadState(this.states);
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,
stationConstsMap,
} from './StationConfig';
import { CategoryType } from '../Platform/PlatformConfig';
import { StyleType } from 'common/common';
class ConstrolGraphic extends Container {
categoryType: CategoryType;
export class ConstrolGraphic extends Container {
constrolConfig?: ConstrolItemConfig[];
stateArrowFillColor?: string;
constructor(categoryType: CategoryType) {
constructor() {
super();
this.categoryType = categoryType;
}
draw(stationConsts: StationConstsConfig): void {
const constrolConsts =
@ -97,23 +95,18 @@ class ConstrolGraphic extends Container {
}
export abstract class JlStation extends JlGraphic {
static Type = 'station';
private categoryType: CategoryType;
private styleType: StyleType;
private stationConsts: StationConstsConfig;
codeGraph: VectorText = new VectorText(''); //车站名
kilometerGraph: VectorText = new VectorText(''); //公里标
controlGraphic?: ConstrolGraphic;
constructor(categoryType: CategoryType) {
constructor(styleType: StyleType) {
super(JlStation.Type);
this.categoryType = categoryType;
this.styleType = styleType;
this.stationConsts = stationConstsMap.get(
this.categoryType,
this.styleType,
) as StationConstsConfig;
this.addChild(this.codeGraph);
this.addChild(this.kilometerGraph);
if (this.stationConsts.constrolGraphic) {
this.controlGraphic = new ConstrolGraphic(categoryType);
this.addChild(this.controlGraphic);
}
}
get datas(): IStationData {
@ -126,15 +119,13 @@ export abstract class JlStation extends JlGraphic {
doRepaint(): void {
const codeGraph = this.codeGraph;
const kilometerGraph = this.kilometerGraph;
const controlGraphic = this.controlGraphic;
controlGraphic?.clear();
switch (this.categoryType) {
case CategoryType.XiAn:
switch (this.styleType) {
case StyleType.TH:
codeGraph.text = this.datas?.code
? `${this.datas?.name}(${this.datas?.code})`
: `${this.datas?.name}`;
break;
case CategoryType.BeiJing:
case StyleType.GP:
codeGraph.text = this.datas?.code || '车站Station';
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 { CategoryType } from '../Platform/PlatformConfig';
import { IRelatedRef, KilometerSystem } from 'common/common';
import { StyleType } from 'common/common';
import { KilometerSystem } from 'common/common';
export interface StationConstsConfig {
codeColor: string;
@ -33,7 +33,7 @@ export interface InArrowConfig {
inArrowFillColorBlue: string;
}
export const BeiJingConsts = {
export const GPConsts = {
codeColor: '0xF48815',
codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF',
@ -41,7 +41,7 @@ export const BeiJingConsts = {
kilometerCodeOffsetY: -25,
};
export const XiAnConsts = {
export const THConsts = {
codeColor: '0xF48815',
codeFontSize: 22,
kilometerCodeColor: '0xFFFFFF',
@ -116,9 +116,9 @@ export const otherConsts = {
},
};
export const stationConstsMap = new Map<CategoryType, StationConstsConfig>([
[CategoryType.BeiJing, BeiJingConsts],
[CategoryType.XiAn, XiAnConsts],
export const stationConstsMap = new Map<StyleType, StationConstsConfig>([
[StyleType.GP, GPConsts],
[StyleType.TH, THConsts],
]);
export interface IStationData extends GraphicData {

View File

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

View File

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

View File

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