站台状态结构调整

This commit is contained in:
joylink_zhaoerwei 2023-12-26 10:25:57 +08:00
parent c6befd256a
commit c0ba01fe2a
6 changed files with 256 additions and 224 deletions

View File

@ -1,12 +1,12 @@
import { JlGraphic, JlGraphicTemplate, VectorText } from "jl-graphic";
import { Container, Graphics } from 'pixi.js';
import { CategoryType, IBriJingPlatformState, IPlatformData, IXiAnPlatformState, PlatformConstsConfig } from './PlatformConfig';
type IPlatformState = IBriJingPlatformState | IXiAnPlatformState;
import { CategoryType, IBeiJingPlatformState, IPlatformData, IXiAnPlatformState, PlatformConstsConfig } from './PlatformConfig';
type IPlatformState = IBeiJingPlatformState | IXiAnPlatformState;
declare class RectGraphic extends Container {
static Type: string;
rectGraphic: Graphics;
constructor();
draw(state: IPlatformState, platformConsts: PlatformConstsConfig): void;
draw(categoryType: CategoryType, stateData: IPlatformState, platformConsts: PlatformConstsConfig): void;
clear(): void;
}
export declare class DoorGraphic extends Container {
@ -14,9 +14,9 @@ export declare class DoorGraphic extends Container {
doorGraphic: Graphics;
doorCloseGraphic: Graphics;
constructor();
draw(stateData: IXiAnPlatformState, ipRtuStusDown: boolean, platformConsts: PlatformConstsConfig): void;
draw(categoryType: CategoryType, stateData: IPlatformState, platformConsts: PlatformConstsConfig, ipRtuStusDown: boolean): void;
clear(): void;
changeState(stateData: IXiAnPlatformState): void;
changeState(categoryType: CategoryType, stateData: IPlatformState): void;
}
declare class CodeGraph extends Container {
static Type: string;
@ -28,7 +28,7 @@ declare class CodeGraph extends Container {
constructor(platformConsts: PlatformConstsConfig);
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
changeState(stateData: IXiAnPlatformState, platformConsts: PlatformConstsConfig): void;
changeState(categoryType: CategoryType, stateData: IPlatformState, platformConsts: PlatformConstsConfig): void;
}
declare class LozengeGraphic extends Container {
static Type: string;
@ -36,7 +36,7 @@ declare class LozengeGraphic extends Container {
constructor();
draw(platformConsts: PlatformConstsConfig): void;
clear(): void;
changeState(stateData: IXiAnPlatformState): void;
changeState(categoryType: CategoryType, stateData: IPlatformState): void;
}
export declare class Platform extends JlGraphic {
static Type: string;
@ -53,7 +53,7 @@ export declare class Platform extends JlGraphic {
}
export declare class PlatformTemplate extends JlGraphicTemplate<Platform> {
categoryType: CategoryType;
constructor(dataTemplate: IPlatformData, stateTemplate: IPlatformState, gategoryConsts: CategoryType);
constructor(dataTemplate: IPlatformData, stateTemplate: IPlatformState, categoryType: CategoryType);
new(): Platform;
}
export {};

View File

@ -1,27 +1,30 @@
import { JlGraphic, calculateMirrorPoint, JlGraphicTemplate, getRectangleCenter, VectorText } from 'jl-graphic';
import { Container, Graphics, Color, Point, Rectangle } from 'pixi.js';
import { platformConstsMap, CategoryType } from './PlatformConfig.js';
import { CategoryType, platformConstsMap } from './PlatformConfig.js';
//子元素--矩形
class RectGraphic extends Container {
static Type = 'RectPlatForm';
static Type = 'Rect';
rectGraphic;
constructor() {
super();
this.rectGraphic = new Graphics();
this.addChild(this.rectGraphic);
}
draw(state, platformConsts) {
draw(categoryType, stateData, platformConsts) {
const rectGraphic = this.rectGraphic;
rectGraphic.clear();
let fillColor = platformConsts.grey;
/* if(state instanceof IXiAnPlatformState){
if (state.trainberth) {
fillColor = platformConsts.yellow;
}
if (state.upSkipstop || state.downSkipstop) {
fillColor = platformConsts.blue;
}
} */
let fillColor = platformConsts.noTrainStop;
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (stateXiAn.trainberth) {
fillColor = platformConsts.trainStop;
}
if (stateXiAn.upSkipstop || stateXiAn.downSkipstop) {
fillColor = platformConsts.trainJump;
}
break;
}
rectGraphic
.clear()
.lineStyle(platformConsts.lineWidth, new Color(fillColor))
@ -45,16 +48,21 @@ class DoorGraphic extends Container {
this.addChild(this.doorGraphic);
this.addChild(this.doorCloseGraphic);
}
draw(stateData, ipRtuStusDown, platformConsts) {
draw(categoryType, stateData, platformConsts, ipRtuStusDown) {
const doorConsts = platformConsts.doorGraphic;
const doorGraphic = this.doorGraphic;
const doorCloseGraphic = this.doorCloseGraphic;
let lineColor = doorConsts.doorGreen;
if (ipRtuStusDown) {
lineColor = doorConsts.blueShowColor;
}
else if (stateData.psdCut) {
lineColor = doorConsts.doorRed;
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (ipRtuStusDown) {
lineColor = doorConsts.blueShowColor;
}
else if (stateXiAn.psdCut) {
lineColor = doorConsts.doorRed;
}
break;
}
doorGraphic.clear()
.lineStyle(platformConsts.lineWidth, new Color(lineColor))
@ -72,12 +80,17 @@ class DoorGraphic extends Container {
this.doorGraphic.clear();
this.doorCloseGraphic.clear();
}
changeState(stateData) {
if (stateData.psdOpen) {
this.doorCloseGraphic.visible = false;
}
else {
this.doorCloseGraphic.visible = true;
changeState(categoryType, stateData) {
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (stateXiAn.psdOpen) {
this.doorCloseGraphic.visible = false;
}
else {
this.doorCloseGraphic.visible = true;
}
break;
}
}
}
@ -149,50 +162,55 @@ class CodeGraph extends Container {
clear() {
this.character.destroy();
}
changeState(stateData, platformConsts) {
changeState(categoryType, stateData, platformConsts) {
const codeConsts = platformConsts.codeGraphic;
if (stateData.upHold ||
stateData.upOccHold ||
stateData.downHold ||
stateData.downOccHold) {
this.character.text = 'H';
this.character.visible = true;
this.circle.visible = true;
//上行扣车
if (stateData.upHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateData.upOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateData.upHold && stateData.upOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
//下行扣车
if (stateData.downHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateData.downOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateData.downHold && stateData.downOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
}
//运行等级
if (stateData.nextSectionRunLevel) {
this.runLevel.visible = false;
this.runLevel.text = stateData.nextSectionRunLevel;
}
//运行时间
if (stateData.nextSectionRunTime) {
this.runTime.visible = true;
this.runTime.text = stateData.nextSectionRunTime;
}
//停站时间
if (stateData.stopTime) {
this.stopTime.visible = true;
this.stopTime.text = stateData.stopTime;
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (stateXiAn.upHold ||
stateXiAn.upOccHold ||
stateXiAn.downHold ||
stateXiAn.downOccHold) {
this.character.text = 'H';
this.character.visible = true;
this.circle.visible = true;
//上行扣车
if (stateXiAn.upHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateXiAn.upOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateXiAn.upHold && stateXiAn.upOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
//下行扣车
if (stateXiAn.downHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateXiAn.downOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateXiAn.downHold && stateXiAn.downOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
}
//运行等级
if (stateXiAn.nextSectionRunLevel) {
this.runLevel.visible = false;
this.runLevel.text = stateXiAn.nextSectionRunLevel;
}
//运行时间
if (stateXiAn.nextSectionRunTime) {
this.runTime.visible = true;
this.runTime.text = stateXiAn.nextSectionRunTime;
}
//停站时间
if (stateXiAn.stopTime) {
this.stopTime.visible = true;
this.stopTime.text = stateXiAn.stopTime;
}
break;
}
}
}
@ -221,12 +239,17 @@ class LozengeGraphic extends Container {
clear() {
this.lozengeGraphic.clear();
}
changeState(stateData) {
if (stateData.emergstop) {
this.lozengeGraphic.visible = true;
}
else {
this.lozengeGraphic.visible = false;
changeState(categoryType, stateData) {
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn = stateData;
if (stateXiAn.emergstop) {
this.lozengeGraphic.visible = true;
}
else {
this.lozengeGraphic.visible = false;
}
break;
}
}
}
@ -240,8 +263,8 @@ class Platform extends JlGraphic {
constructor(categoryType) {
super(Platform.Type);
this.categoryType = categoryType;
this.addChild(this.rectGraphic);
const platformConsts = platformConstsMap.get(this.categoryType);
this.addChild(this.rectGraphic);
if (platformConsts.doorGraphic) {
this.doorGraphic = new DoorGraphic();
this.addChild(this.doorGraphic);
@ -259,47 +282,41 @@ class Platform extends JlGraphic {
return this.getDatas();
}
get states() {
if (this.categoryType == CategoryType.BeiJing) {
return this.getStates();
}
else {
return this.getStates();
}
return this.getStates();
}
doRepaint() {
this.doorGraphic?.clear();
const platformConsts = platformConstsMap.get(this.categoryType);
this.rectGraphic.draw(this.states, platformConsts);
if (this.doorGraphic) {
const states = this.states;
this.rectGraphic.draw(this.categoryType, this.states, platformConsts);
if (this.datas.hasdoor && this.doorGraphic) {
const doorConsts = platformConsts.doorGraphic;
/* const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
states.rtuId > 9 ? '' + states.rtuId : '0' + states.rtuId,
Station.Type
); */
this.doorGraphic.draw(states, false, platformConsts);
const doorConsts = platformConsts.doorGraphic;
this.doorGraphic.draw(this.categoryType, this.states, platformConsts, false);
this.doorGraphic.position.set(0, -platformConsts.height / 2 - doorConsts.doorPlatformSpacing);
if (this.datas.direction == 'down') {
this.doorGraphic.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.doorGraphic.position));
}
}
if (this.codeGraph) {
const codeConsts = platformConsts.codeGraphic;
this.codeGraph.draw(platformConsts);
this.codeGraph.position.set(0, 0);
if (this.datas.direction == 'down') {
const psChange = [
this.codeGraph?.children[0],
this.codeGraph?.children[1],
this.codeGraph?.children[3],
this.codeGraph?.children[4],
this.codeGraph?.character,
this.codeGraph?.runLevel,
this.codeGraph?.stopTime,
this.codeGraph?.circle,
];
psChange.forEach((g) => {
if (g) {
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), g.position));
}
});
const codeConsts = platformConsts.codeGraphic;
this.codeGraph?.children[2].position.set(platformConsts.width / 2 +
this.codeGraph?.runTime.position.set(platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
(codeConsts.besideSpacing * 4) / 3, (-platformConsts.height * 10) / 11);
}
@ -318,17 +335,16 @@ class Platform extends JlGraphic {
}
changeState() {
const platformConsts = platformConstsMap.get(this.categoryType);
const states = this.states;
this.doorGraphic?.changeState(states);
this.lozengeGraphic?.changeState(states);
this.codeGraph?.changeState(states, platformConsts);
this.doorGraphic?.changeState(this.categoryType, this.states);
this.lozengeGraphic?.changeState(this.categoryType, this.states);
this.codeGraph?.changeState(this.categoryType, this.states, platformConsts);
}
}
class PlatformTemplate extends JlGraphicTemplate {
categoryType;
constructor(dataTemplate, stateTemplate, gategoryConsts) {
constructor(dataTemplate, stateTemplate, categoryType) {
super(Platform.Type, { dataTemplate, stateTemplate });
this.categoryType = gategoryConsts;
this.categoryType = categoryType;
}
new() {
const g = new Platform(this.categoryType);

View File

@ -7,9 +7,9 @@ export interface PlatformConstsConfig {
width: number;
height: number;
lineWidth: number;
grey: string;
yellow: string;
blue: string;
noTrainStop: string;
trainStop: string;
trainJump: string;
doorGraphic?: DoorConstsConfig;
codeGraphic?: CodeConstsConfig;
lozengeGraphic?: LozengeConstsConfig;
@ -92,7 +92,7 @@ export interface IXiAnPlatformState extends GraphicState {
get rtuId(): number;
set rtuId(v: number);
}
export interface IBriJingPlatformState extends GraphicState {
export interface IBeiJingPlatformState extends GraphicState {
id?: number;
}
export {};

View File

@ -7,17 +7,17 @@ const BeiJingConsts = {
width: 90,
height: 20,
lineWidth: 3,
grey: '0x7F7F7F',
yellow: '0xfbff00',
blue: '0xC0C0FE',
noTrainStop: '0x7F7F7F',
trainStop: '0xfbff00',
trainJump: '0xC0C0FE',
};
const XiAnConsts = {
width: 90,
height: 20,
lineWidth: 3,
grey: '0x7F7F7F',
yellow: '0xfbff00',
blue: '0xC0C0FE',
noTrainStop: '0xffffff',
trainStop: '0xfbff00',
trainJump: '0xC0C0FE',
blueShowColor: '0x3149c3',
doorGraphic: {
blueShowColor: '0x3149c3',

View File

@ -1,28 +1,31 @@
import { JlGraphic, JlGraphicTemplate, VectorText, calculateMirrorPoint, distance2, getRectangleCenter } from "jl-graphic";
import { Container,Graphics,Rectangle,Color,Point } from 'pixi.js'
import {CategoryType, CodeConstsConfig, DoorConstsConfig, IBriJingPlatformState, IPlatformData, IXiAnPlatformState, LozengeConstsConfig, PlatformConstsConfig, platformConstsMap }from './PlatformConfig'
import {CategoryType, CodeConstsConfig, DoorConstsConfig, IBeiJingPlatformState, IPlatformData, IXiAnPlatformState, LozengeConstsConfig, PlatformConstsConfig, platformConstsMap }from './PlatformConfig'
type IPlatformState=IBriJingPlatformState|IXiAnPlatformState
type IPlatformState=IBeiJingPlatformState|IXiAnPlatformState
//子元素--矩形
class RectGraphic extends Container {
static Type = 'RectPlatForm';
static Type = 'Rect';
rectGraphic: Graphics;
constructor() {
super();
this.rectGraphic = new Graphics();
this.addChild(this.rectGraphic);
}
draw(state: IPlatformState,platformConsts: PlatformConstsConfig): void {
draw(categoryType:CategoryType,stateData: IPlatformState,platformConsts: PlatformConstsConfig): void {
const rectGraphic = this.rectGraphic;
rectGraphic.clear();
let fillColor = platformConsts.grey;
/* if(state instanceof IXiAnPlatformState){
if (state.trainberth) {
fillColor = platformConsts.yellow;
}
if (state.upSkipstop || state.downSkipstop) {
fillColor = platformConsts.blue;
}
} */
let fillColor = platformConsts.noTrainStop;
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn=stateData as IXiAnPlatformState
if (stateXiAn.trainberth) {
fillColor = platformConsts.trainStop;
}
if (stateXiAn.upSkipstop || stateXiAn.downSkipstop) {
fillColor = platformConsts.trainJump;
}
break;
}
rectGraphic
.clear()
.lineStyle(platformConsts.lineWidth, new Color(fillColor))
@ -36,7 +39,6 @@ class RectGraphic extends Container {
this.rectGraphic.clear();
}
}
//子元素--门
export class DoorGraphic extends Container {
static Type = 'Door';
@ -49,15 +51,20 @@ export class DoorGraphic extends Container {
this.addChild(this.doorGraphic);
this.addChild(this.doorCloseGraphic);
}
draw(stateData: IXiAnPlatformState, ipRtuStusDown: boolean,platformConsts:PlatformConstsConfig): void {
draw(categoryType:CategoryType,stateData: IPlatformState,platformConsts:PlatformConstsConfig, ipRtuStusDown: boolean): void {
const doorConsts=platformConsts.doorGraphic as DoorConstsConfig
const doorGraphic = this.doorGraphic;
const doorCloseGraphic = this.doorCloseGraphic;
let lineColor = doorConsts.doorGreen;
if (ipRtuStusDown) {
lineColor = doorConsts.blueShowColor;
} else if (stateData.psdCut) {
lineColor = doorConsts.doorRed;
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn=stateData as IXiAnPlatformState
if (ipRtuStusDown) {
lineColor = doorConsts.blueShowColor;
} else if (stateXiAn.psdCut) {
lineColor = doorConsts.doorRed;
}
break;
}
doorGraphic.clear()
.lineStyle(platformConsts.lineWidth, new Color(lineColor))
@ -81,11 +88,16 @@ export class DoorGraphic extends Container {
this.doorGraphic.clear();
this.doorCloseGraphic.clear();
}
changeState(stateData: IXiAnPlatformState): void {
if (stateData.psdOpen) {
this.doorCloseGraphic.visible = false;
} else {
this.doorCloseGraphic.visible = true;
changeState(categoryType:CategoryType,stateData: IPlatformState): void {
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn=stateData as IXiAnPlatformState
if (stateXiAn.psdOpen) {
this.doorCloseGraphic.visible = false;
} else {
this.doorCloseGraphic.visible = true;
}
break;
}
}
}
@ -172,52 +184,57 @@ class CodeGraph extends Container {
clear(): void {
this.character.destroy();
}
changeState(stateData: IXiAnPlatformState,platformConsts:PlatformConstsConfig): void {
changeState(categoryType:CategoryType,stateData: IPlatformState,platformConsts:PlatformConstsConfig): void {
const codeConsts=platformConsts.codeGraphic as CodeConstsConfig
if (
stateData.upHold ||
stateData.upOccHold ||
stateData.downHold ||
stateData.downOccHold
) {
this.character.text = 'H';
this.character.visible = true;
this.circle.visible = true;
//上行扣车
if (stateData.upHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateData.upOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateData.upHold && stateData.upOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
//下行扣车
if (stateData.downHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateData.downOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateData.downHold && stateData.downOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
}
//运行等级
if (stateData.nextSectionRunLevel) {
this.runLevel.visible = false;
this.runLevel.text = stateData.nextSectionRunLevel;
}
//运行时间
if (stateData.nextSectionRunTime) {
this.runTime.visible = true;
this.runTime.text = stateData.nextSectionRunTime;
}
//停站时间
if (stateData.stopTime) {
this.stopTime.visible = true;
this.stopTime.text = stateData.stopTime;
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn=stateData as IXiAnPlatformState
if (
stateXiAn.upHold ||
stateXiAn.upOccHold ||
stateXiAn.downHold ||
stateXiAn.downOccHold
) {
this.character.text = 'H';
this.character.visible = true;
this.circle.visible = true;
//上行扣车
if (stateXiAn.upHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateXiAn.upOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateXiAn.upHold && stateXiAn.upOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
//下行扣车
if (stateXiAn.downHold) {
this.character.style.fill = codeConsts.HCharYellow;
}
if (stateXiAn.downOccHold) {
this.character.style.fill = codeConsts.HCharWhite;
}
if (stateXiAn.downHold && stateXiAn.downOccHold) {
this.character.style.fill = codeConsts.HCharRed;
}
}
//运行等级
if (stateXiAn.nextSectionRunLevel) {
this.runLevel.visible = false;
this.runLevel.text = stateXiAn.nextSectionRunLevel;
}
//运行时间
if (stateXiAn.nextSectionRunTime) {
this.runTime.visible = true;
this.runTime.text = stateXiAn.nextSectionRunTime;
}
//停站时间
if (stateXiAn.stopTime) {
this.stopTime.visible = true;
this.stopTime.text = stateXiAn.stopTime;
}
break;
}
}
}
@ -256,11 +273,16 @@ class LozengeGraphic extends Container {
clear(): void {
this.lozengeGraphic.clear();
}
changeState(stateData: IXiAnPlatformState): void {
if (stateData.emergstop) {
this.lozengeGraphic.visible = true;
} else {
this.lozengeGraphic.visible = false;
changeState(categoryType:CategoryType,stateData: IPlatformState): void {
switch (categoryType) {
case CategoryType.XiAn:
const stateXiAn=stateData as IXiAnPlatformState
if (stateXiAn.emergstop) {
this.lozengeGraphic.visible = true;
} else {
this.lozengeGraphic.visible = false;
}
break;
}
}
}
@ -275,8 +297,8 @@ export class Platform extends JlGraphic {
constructor(categoryType:CategoryType) {
super(Platform.Type);
this.categoryType = categoryType
this.addChild(this.rectGraphic);
const platformConsts=platformConstsMap.get(this.categoryType) as PlatformConstsConfig
this.addChild(this.rectGraphic);
if(platformConsts.doorGraphic){
this.doorGraphic = new DoorGraphic()
this.addChild(this.doorGraphic);
@ -294,24 +316,19 @@ export class Platform extends JlGraphic {
return this.getDatas<IPlatformData>();
}
get states(): IPlatformState {
if(this.categoryType==CategoryType.BeiJing){
return this.getStates<IBriJingPlatformState>();
}else{
return this.getStates<IXiAnPlatformState>();
}
return this.getStates<IPlatformState>();
}
doRepaint(): void {
this.doorGraphic?.clear();
const platformConsts=platformConstsMap.get(this.categoryType) as PlatformConstsConfig
this.rectGraphic.draw(this.states, platformConsts);
if(this.doorGraphic){
const states=this.states as IXiAnPlatformState
this.rectGraphic.draw(this.categoryType,this.states, platformConsts);
if(this.datas.hasdoor && this.doorGraphic){
const doorConsts= platformConsts.doorGraphic as DoorConstsConfig
/* const station = this.getGraphicApp().queryStore.queryByCodeAndType<Station>(
states.rtuId > 9 ? '' + states.rtuId : '0' + states.rtuId,
Station.Type
); */
this.doorGraphic.draw(states,false,platformConsts)
const doorConsts= platformConsts.doorGraphic as DoorConstsConfig
this.doorGraphic.draw(this.categoryType,this.states,platformConsts,false)
this.doorGraphic.position.set(
0,
-platformConsts.height / 2 -doorConsts.doorPlatformSpacing
@ -321,22 +338,22 @@ export class Platform extends JlGraphic {
}
}
if(this.codeGraph){
const codeConsts=platformConsts.codeGraphic as CodeConstsConfig
this.codeGraph.draw(platformConsts);
this.codeGraph.position.set(0, 0);
if (this.datas.direction == 'down') {
const psChange = [
this.codeGraph?.children[0],
this.codeGraph?.children[1],
this.codeGraph?.children[3],
this.codeGraph?.children[4],
this.codeGraph?.character,
this.codeGraph?.runLevel,
this.codeGraph?.stopTime,
this.codeGraph?.circle,
];
psChange.forEach((g) => {
if(g){
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), g.position));
}
});
const codeConsts=platformConsts.codeGraphic as CodeConstsConfig
this.codeGraph?.children[2].position.set(
this.codeGraph?.runTime.position.set(
platformConsts.width / 2 +
platformConsts.lineWidth / 2 +
(codeConsts.besideSpacing * 4) / 3,
@ -361,10 +378,9 @@ export class Platform extends JlGraphic {
}
changeState(): void {
const platformConsts=platformConstsMap.get(this.categoryType) as PlatformConstsConfig
const states=this.states as IXiAnPlatformState
this.doorGraphic?.changeState(states);
this.lozengeGraphic?.changeState(states);
this.codeGraph?.changeState(states,platformConsts);
this.doorGraphic?.changeState(this.categoryType,this.states);
this.lozengeGraphic?.changeState(this.categoryType,this.states);
this.codeGraph?.changeState(this.categoryType,this.states,platformConsts);
}
}
export class PlatformTemplate extends JlGraphicTemplate<Platform> {
@ -372,10 +388,10 @@ export class PlatformTemplate extends JlGraphicTemplate<Platform> {
constructor(
dataTemplate: IPlatformData,
stateTemplate: IPlatformState,
gategoryConsts: CategoryType
categoryType: CategoryType
) {
super(Platform.Type, { dataTemplate, stateTemplate });
this.categoryType = gategoryConsts;
this.categoryType = categoryType;
}
new(): Platform {
const g = new Platform(this.categoryType);

View File

@ -9,9 +9,9 @@ export interface PlatformConstsConfig{
width: number,
height: number,
lineWidth: number,
grey: string, //站台没有列车停站
yellow :string, //列车在站台停站
blue : string, //列车在站台跳停
noTrainStop: string, //站台没有列车停站
trainStop :string, //列车在站台停站
trainJump : string, //列车在站台跳停
doorGraphic?:DoorConstsConfig,
codeGraphic?:CodeConstsConfig,
lozengeGraphic?:LozengeConstsConfig //站台旁的菱形图标
@ -46,18 +46,18 @@ const BeiJingConsts = {
width: 90,
height: 20,
lineWidth: 3,
grey: '0x7F7F7F',
yellow :'0xfbff00',
blue : '0xC0C0FE',
noTrainStop: '0x7F7F7F',
trainStop :'0xfbff00',
trainJump : '0xC0C0FE',
};
const XiAnConsts = {
width: 90,
height: 20,
lineWidth: 3,
grey: '0x7F7F7F',
yellow :'0xfbff00',
blue : '0xC0C0FE',
noTrainStop: '0xffffff',
trainStop :'0xfbff00',
trainJump : '0xC0C0FE',
blueShowColor: '0x3149c3',
doorGraphic:{
blueShowColor: '0x3149c3',
@ -141,6 +141,6 @@ export interface IXiAnPlatformState extends GraphicState {
get rtuId(): number; // 集中站站号
set rtuId(v: number);
}
export interface IBriJingPlatformState extends GraphicState {
export interface IBeiJingPlatformState extends GraphicState {
id?: number;
}