测试
This commit is contained in:
parent
8f979a4a9c
commit
ed9be45c6a
@ -19,6 +19,7 @@ class THPlatform extends JlPlatform {
|
|||||||
return this.getStates();
|
return this.getStates();
|
||||||
}
|
}
|
||||||
doRepaint() {
|
doRepaint() {
|
||||||
|
//站台状态
|
||||||
this.rectGraphic.stateFillColor = THConsts.noTrainStop;
|
this.rectGraphic.stateFillColor = THConsts.noTrainStop;
|
||||||
if (this.states.trainberth) {
|
if (this.states.trainberth) {
|
||||||
this.rectGraphic.stateFillColor = THConsts.trainStop;
|
this.rectGraphic.stateFillColor = THConsts.trainStop;
|
||||||
@ -26,35 +27,35 @@ class THPlatform extends JlPlatform {
|
|||||||
if (this.states.upSkipstop || this.states.downSkipstop) {
|
if (this.states.upSkipstop || this.states.downSkipstop) {
|
||||||
this.rectGraphic.stateFillColor = THConsts.trainJump;
|
this.rectGraphic.stateFillColor = THConsts.trainJump;
|
||||||
}
|
}
|
||||||
|
//门的状态
|
||||||
const station = this.getGraphicApp().queryStore.queryByCodeAndType(this.states.rtuId > 9
|
const station = this.getGraphicApp().queryStore.queryByCodeAndType(this.states.rtuId > 9
|
||||||
? '' + this.states.rtuId
|
? '' + this.states.rtuId
|
||||||
: '0' + this.states.rtuId, THStation.Type);
|
: '0' + this.states.rtuId, THStation.Type);
|
||||||
const doorGraphic = this.doorGraphic;
|
this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
|
|
||||||
if (!!station?.states.ipRtuStusDown) {
|
if (!!station?.states.ipRtuStusDown) {
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
|
this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
|
||||||
}
|
}
|
||||||
else if (this.states.psdCut) {
|
else if (this.states.psdCut) {
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
|
this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
|
||||||
}
|
}
|
||||||
super.draw();
|
super.draw();
|
||||||
this.doorGraphic.draw();
|
this.doorGraphic.draw();
|
||||||
this.codeGraphic.draw();
|
this.codeGraphic.draw();
|
||||||
this.lozengeGraphic.draw();
|
|
||||||
if (this.datas.direction == 'down') {
|
if (this.datas.direction == 'down') {
|
||||||
this.doorGraphic.changePosition();
|
this.doorGraphic.changePosition();
|
||||||
this.codeGraphic.changePosition();
|
this.codeGraphic.changePosition();
|
||||||
this.lozengeGraphic.changePosition();
|
this.lozengeGraphic.changePosition();
|
||||||
}
|
}
|
||||||
//门的状态
|
//门的显示与隐藏
|
||||||
if (this.datas.hasdoor) {
|
if (this.datas.hasdoor) {
|
||||||
if (this.states.psdOpen) {
|
if (this.states.psdOpen) {
|
||||||
doorGraphic.doorCloseGraphic.visible = false;
|
this.doorGraphic.doorCloseGraphic.visible = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
doorGraphic.doorCloseGraphic.visible = true;
|
this.doorGraphic.doorCloseGraphic.visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//紧急停车
|
||||||
if (this.states.emergstop) {
|
if (this.states.emergstop) {
|
||||||
this.lozengeGraphic.lozenge.visible = true;
|
this.lozengeGraphic.lozenge.visible = true;
|
||||||
}
|
}
|
||||||
@ -67,7 +68,6 @@ class THPlatform extends JlPlatform {
|
|||||||
this.states.upOccHold ||
|
this.states.upOccHold ||
|
||||||
this.states.downHold ||
|
this.states.downHold ||
|
||||||
this.states.downOccHold) {
|
this.states.downOccHold) {
|
||||||
codeGraphic.character.text = 'H';
|
|
||||||
codeGraphic.character.visible = true;
|
codeGraphic.character.visible = true;
|
||||||
codeGraphic.circle.visible = true;
|
codeGraphic.circle.visible = true;
|
||||||
//上行扣车
|
//上行扣车
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { JlGraphic, VectorText } from 'jl-graphic';
|
import { JlGraphic, VectorText } from 'jl-graphic';
|
||||||
import { Container, Graphics, IPointData } from 'pixi.js';
|
import { Container, Graphics } from 'pixi.js';
|
||||||
import { IPlatformData, PlatformConstsConfig } from './PlatformConfig';
|
import { IPlatformData, PlatformConstsConfig } from './PlatformConfig';
|
||||||
declare class RectGraphic extends Container {
|
declare class RectGraphic extends Container {
|
||||||
platformConsts: PlatformConstsConfig;
|
platformConsts: PlatformConstsConfig;
|
||||||
@ -28,6 +28,8 @@ export declare class CodeGraphic extends Container {
|
|||||||
circle: Graphics;
|
circle: Graphics;
|
||||||
constructor(platformConsts: PlatformConstsConfig);
|
constructor(platformConsts: PlatformConstsConfig);
|
||||||
draw(): void;
|
draw(): void;
|
||||||
|
drawNoChange(): void;
|
||||||
|
setPosition(): void;
|
||||||
changePosition(): void;
|
changePosition(): void;
|
||||||
clear(): void;
|
clear(): void;
|
||||||
}
|
}
|
||||||
@ -35,7 +37,7 @@ export declare class LozengeGraphic extends Container {
|
|||||||
platformConsts: PlatformConstsConfig;
|
platformConsts: PlatformConstsConfig;
|
||||||
lozenge: Graphics;
|
lozenge: Graphics;
|
||||||
constructor(platformConsts: PlatformConstsConfig);
|
constructor(platformConsts: PlatformConstsConfig);
|
||||||
draw(): void;
|
drawNoChange(): void;
|
||||||
changePosition(): void;
|
changePosition(): void;
|
||||||
clear(): void;
|
clear(): void;
|
||||||
}
|
}
|
||||||
@ -45,7 +47,7 @@ export declare class DoorCodeLozenge extends Container {
|
|||||||
lozengeGraphic: LozengeGraphic;
|
lozengeGraphic: LozengeGraphic;
|
||||||
codeGraphic: CodeGraphic;
|
codeGraphic: CodeGraphic;
|
||||||
constructor(platformConsts: PlatformConstsConfig);
|
constructor(platformConsts: PlatformConstsConfig);
|
||||||
draw(hasDoor: boolean, direction: string, platformPos: IPointData): void;
|
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;
|
||||||
|
@ -79,52 +79,23 @@ class CodeGraphic extends Container {
|
|||||||
constructor(platformConsts) {
|
constructor(platformConsts) {
|
||||||
super();
|
super();
|
||||||
this.platformConsts = platformConsts;
|
this.platformConsts = platformConsts;
|
||||||
this.addChild(this.character);
|
|
||||||
this.addChild(this.runLevel);
|
|
||||||
this.addChild(this.circle);
|
|
||||||
this.addChild(this.stopTime);
|
|
||||||
this.addChild(this.runTime);
|
|
||||||
const codeConsts = platformConsts.codeGraphic;
|
const codeConsts = platformConsts.codeGraphic;
|
||||||
this.character.setVectorFontSize(codeConsts.besideFontSize);
|
const childrenGraphics = [
|
||||||
this.runLevel.setVectorFontSize(codeConsts.besideFontSize);
|
this.character,
|
||||||
this.stopTime.setVectorFontSize(codeConsts.besideFontSize);
|
this.runLevel,
|
||||||
this.runTime.setVectorFontSize(codeConsts.besideFontSize);
|
this.runTime,
|
||||||
|
this.stopTime,
|
||||||
|
];
|
||||||
|
childrenGraphics.forEach((child) => {
|
||||||
|
child.setVectorFontSize(codeConsts.besideFontSize);
|
||||||
|
child.anchor.set(0.5);
|
||||||
|
child.style.fill = codeConsts.whiteNumbers;
|
||||||
|
this.addChild(child);
|
||||||
|
});
|
||||||
|
this.addChild(this.circle);
|
||||||
|
this.drawNoChange();
|
||||||
}
|
}
|
||||||
draw() {
|
draw() {
|
||||||
const platformConsts = this.platformConsts;
|
|
||||||
const codeConsts = this.platformConsts.codeGraphic;
|
|
||||||
//扣车
|
|
||||||
this.character.text = 'H';
|
|
||||||
this.character.anchor.set(0.5);
|
|
||||||
this.character.position.set(-platformConsts.width / 2 -
|
|
||||||
platformConsts.lineWidth / 2 -
|
|
||||||
(codeConsts.besideSpacing * 2) / 3, (platformConsts.height * 3) / 4);
|
|
||||||
this.character.style.fill = codeConsts.whiteNumbers;
|
|
||||||
this.circle
|
|
||||||
.clear()
|
|
||||||
.lineStyle(0.5, codeConsts.whiteCircle)
|
|
||||||
.drawCircle(0, 0, codeConsts.circleRadius);
|
|
||||||
this.circle.position.set(-platformConsts.width / 2 -
|
|
||||||
platformConsts.lineWidth / 2 -
|
|
||||||
(codeConsts.besideSpacing * 4) / 3, (platformConsts.height * 3) / 5);
|
|
||||||
//区间运行等级状态
|
|
||||||
this.runLevel.anchor.set(0.5);
|
|
||||||
this.runLevel.position.set(platformConsts.width / 2 +
|
|
||||||
platformConsts.lineWidth / 2 +
|
|
||||||
3 * codeConsts.besideSpacing, -codeConsts.besideSpacing);
|
|
||||||
this.runLevel.style.fill = codeConsts.whiteNumbers;
|
|
||||||
//区间运行时间
|
|
||||||
this.runTime.anchor.set(0.5);
|
|
||||||
this.runTime.position.set(platformConsts.width / 2 +
|
|
||||||
platformConsts.lineWidth / 2 +
|
|
||||||
codeConsts.besideSpacing, -codeConsts.besideSpacing);
|
|
||||||
this.runTime.style.fill = codeConsts.whiteNumbers;
|
|
||||||
//停站时间
|
|
||||||
this.stopTime.anchor.set(0.5);
|
|
||||||
this.stopTime.position.set(platformConsts.width / 2 +
|
|
||||||
platformConsts.lineWidth / 2 +
|
|
||||||
codeConsts.besideSpacing, codeConsts.besideSpacing);
|
|
||||||
this.stopTime.style.fill = codeConsts.whiteNumbers;
|
|
||||||
this.character.visible = false;
|
this.character.visible = false;
|
||||||
this.circle.visible = false;
|
this.circle.visible = false;
|
||||||
this.runLevel.visible = false;
|
this.runLevel.visible = false;
|
||||||
@ -132,6 +103,38 @@ class CodeGraphic extends Container {
|
|||||||
this.runTime.visible = false;
|
this.runTime.visible = false;
|
||||||
this.position.set(0, 0);
|
this.position.set(0, 0);
|
||||||
}
|
}
|
||||||
|
drawNoChange() {
|
||||||
|
const codeConsts = this.platformConsts.codeGraphic;
|
||||||
|
this.circle
|
||||||
|
.clear()
|
||||||
|
.lineStyle(0.5, codeConsts.whiteCircle)
|
||||||
|
.drawCircle(0, 0, codeConsts.circleRadius);
|
||||||
|
this.character.text = 'H';
|
||||||
|
this.setPosition();
|
||||||
|
}
|
||||||
|
setPosition() {
|
||||||
|
//扣车
|
||||||
|
const platformConsts = this.platformConsts;
|
||||||
|
const codeConsts = this.platformConsts.codeGraphic;
|
||||||
|
this.character.position.set(-platformConsts.width / 2 -
|
||||||
|
platformConsts.lineWidth / 2 -
|
||||||
|
(codeConsts.besideSpacing * 2) / 3, (platformConsts.height * 3) / 4);
|
||||||
|
this.circle.position.set(-platformConsts.width / 2 -
|
||||||
|
platformConsts.lineWidth / 2 -
|
||||||
|
(codeConsts.besideSpacing * 4) / 3, (platformConsts.height * 3) / 5);
|
||||||
|
//区间运行等级状态
|
||||||
|
this.runLevel.position.set(platformConsts.width / 2 +
|
||||||
|
platformConsts.lineWidth / 2 +
|
||||||
|
3 * codeConsts.besideSpacing, -codeConsts.besideSpacing);
|
||||||
|
//区间运行时间
|
||||||
|
this.runTime.position.set(platformConsts.width / 2 +
|
||||||
|
platformConsts.lineWidth / 2 +
|
||||||
|
codeConsts.besideSpacing, -codeConsts.besideSpacing);
|
||||||
|
//停站时间
|
||||||
|
this.stopTime.position.set(platformConsts.width / 2 +
|
||||||
|
platformConsts.lineWidth / 2 +
|
||||||
|
codeConsts.besideSpacing, codeConsts.besideSpacing);
|
||||||
|
}
|
||||||
changePosition() {
|
changePosition() {
|
||||||
const codeConsts = this.platformConsts.codeGraphic;
|
const codeConsts = this.platformConsts.codeGraphic;
|
||||||
const psChange = [
|
const psChange = [
|
||||||
@ -162,8 +165,9 @@ class LozengeGraphic extends Container {
|
|||||||
this.platformConsts = platformConsts;
|
this.platformConsts = platformConsts;
|
||||||
this.lozenge = new Graphics();
|
this.lozenge = new Graphics();
|
||||||
this.addChild(this.lozenge);
|
this.addChild(this.lozenge);
|
||||||
|
this.drawNoChange();
|
||||||
}
|
}
|
||||||
draw() {
|
drawNoChange() {
|
||||||
const LozengeConsts = this.platformConsts
|
const LozengeConsts = this.platformConsts
|
||||||
.lozengeGraphic;
|
.lozengeGraphic;
|
||||||
this.lozenge
|
this.lozenge
|
||||||
@ -201,13 +205,12 @@ class DoorCodeLozenge extends Container {
|
|||||||
this.codeGraphic = new CodeGraphic(this.platformConsts);
|
this.codeGraphic = new CodeGraphic(this.platformConsts);
|
||||||
this.addChild(this.codeGraphic);
|
this.addChild(this.codeGraphic);
|
||||||
}
|
}
|
||||||
draw(hasDoor, direction, platformPos) {
|
draw(hasDoor, direction) {
|
||||||
this.doorGraphic.clear();
|
this.doorGraphic.clear();
|
||||||
if (hasDoor) {
|
if (hasDoor) {
|
||||||
this.doorGraphic.draw();
|
this.doorGraphic.draw();
|
||||||
}
|
}
|
||||||
this.codeGraphic.draw();
|
this.codeGraphic.draw();
|
||||||
this.lozengeGraphic.draw();
|
|
||||||
if (direction == 'down') {
|
if (direction == 'down') {
|
||||||
this.doorGraphic.changePosition();
|
this.doorGraphic.changePosition();
|
||||||
this.codeGraphic.changePosition();
|
this.codeGraphic.changePosition();
|
||||||
|
@ -9,7 +9,7 @@ class GPStation extends JlStation {
|
|||||||
return this.getStates();
|
return this.getStates();
|
||||||
}
|
}
|
||||||
doRepaint() {
|
doRepaint() {
|
||||||
super.doRepaint();
|
super.draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class THStation extends JlStation {
|
|||||||
}
|
}
|
||||||
this.controlGraphic.draw(THConsts);
|
this.controlGraphic.draw(THConsts);
|
||||||
}
|
}
|
||||||
super.doRepaint();
|
super.draw();
|
||||||
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();
|
||||||
|
@ -22,5 +22,5 @@ export declare abstract class JlStation extends JlGraphic {
|
|||||||
constructor(styleType: StyleType);
|
constructor(styleType: StyleType);
|
||||||
get datas(): IStationData;
|
get datas(): IStationData;
|
||||||
get code(): string;
|
get code(): string;
|
||||||
doRepaint(): void;
|
draw(): void;
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,12 @@ class JlStation extends JlGraphic {
|
|||||||
super(JlStation.Type);
|
super(JlStation.Type);
|
||||||
this.styleType = styleType;
|
this.styleType = styleType;
|
||||||
this.stationConsts = stationConstsMap.get(this.styleType);
|
this.stationConsts = stationConstsMap.get(this.styleType);
|
||||||
|
this.codeGraph.style.fill = this.stationConsts.codeColor;
|
||||||
|
this.codeGraph.setVectorFontSize(this.stationConsts.codeFontSize);
|
||||||
|
this.codeGraph.anchor.set(0.5);
|
||||||
|
this.kilometerGraph.style.fill = this.stationConsts.kilometerCodeColor;
|
||||||
|
this.kilometerGraph.setVectorFontSize(this.stationConsts.kilometerCodeFontSize);
|
||||||
|
this.kilometerGraph.anchor.set(0.5);
|
||||||
this.addChild(this.codeGraph);
|
this.addChild(this.codeGraph);
|
||||||
this.addChild(this.kilometerGraph);
|
this.addChild(this.kilometerGraph);
|
||||||
}
|
}
|
||||||
@ -92,46 +98,30 @@ class JlStation extends JlGraphic {
|
|||||||
get code() {
|
get code() {
|
||||||
return this.datas.code;
|
return this.datas.code;
|
||||||
}
|
}
|
||||||
doRepaint() {
|
draw() {
|
||||||
const codeGraph = this.codeGraph;
|
|
||||||
const kilometerGraph = this.kilometerGraph;
|
|
||||||
switch (this.styleType) {
|
switch (this.styleType) {
|
||||||
case StyleType.TH:
|
case StyleType.TH:
|
||||||
codeGraph.text = this.datas?.code
|
this.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 StyleType.GP:
|
default:
|
||||||
codeGraph.text = this.datas?.code || '车站Station';
|
this.codeGraph.text = this.datas?.code || '车站Station';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
codeGraph.style.fill = this.stationConsts.codeColor;
|
|
||||||
codeGraph.setVectorFontSize(this.stationConsts.codeFontSize);
|
|
||||||
codeGraph.anchor.set(0.5);
|
|
||||||
const kilometerCode = this.datas.kilometerSystem?.kilometer || 12345678;
|
const kilometerCode = this.datas.kilometerSystem?.kilometer || 12345678;
|
||||||
if (Math.floor(kilometerCode * 1000).toString().length > 3) {
|
if (Math.floor(kilometerCode * 1000).toString().length > 3) {
|
||||||
const kiloBit = Math.floor(Number(kilometerCode) / 1000000).toString();
|
const kiloBit = Math.floor(Number(kilometerCode) / 1000000).toString();
|
||||||
kilometerGraph.text =
|
this.kilometerGraph.text =
|
||||||
'K' +
|
'K' +
|
||||||
kiloBit +
|
kiloBit +
|
||||||
'+' +
|
'+' +
|
||||||
(Number(kilometerCode.toString().substring(kiloBit.length)) / 1000).toFixed(3);
|
(Number(kilometerCode.toString().substring(kiloBit.length)) / 1000).toFixed(3);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
kilometerGraph.text = (kilometerCode * 1000).toFixed(3);
|
this.kilometerGraph.text = (kilometerCode * 1000).toFixed(3);
|
||||||
}
|
|
||||||
kilometerGraph.style.fill = this.stationConsts.kilometerCodeColor;
|
|
||||||
kilometerGraph.setVectorFontSize(this.stationConsts.kilometerCodeFontSize);
|
|
||||||
kilometerGraph.anchor.set(0.5);
|
|
||||||
kilometerGraph.position.set(0, this.stationConsts.kilometerCodeOffsetY);
|
|
||||||
if (this.datas.childTransforms?.length) {
|
|
||||||
this.datas.childTransforms.forEach((child) => {
|
|
||||||
if (child.name == 'kilometer') {
|
|
||||||
const pos = child.transform.position;
|
|
||||||
kilometerGraph.position.set(pos.x, pos.y);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
this.kilometerGraph.position.set(0, this.stationConsts.kilometerCodeOffsetY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ export class THPlatform extends JlPlatform {
|
|||||||
return this.getStates<ITHPlatformState>();
|
return this.getStates<ITHPlatformState>();
|
||||||
}
|
}
|
||||||
doRepaint(): void {
|
doRepaint(): void {
|
||||||
|
//站台状态
|
||||||
this.rectGraphic.stateFillColor = THConsts.noTrainStop;
|
this.rectGraphic.stateFillColor = THConsts.noTrainStop;
|
||||||
if (this.states.trainberth) {
|
if (this.states.trainberth) {
|
||||||
this.rectGraphic.stateFillColor = THConsts.trainStop;
|
this.rectGraphic.stateFillColor = THConsts.trainStop;
|
||||||
@ -69,6 +70,7 @@ export class THPlatform extends JlPlatform {
|
|||||||
if (this.states.upSkipstop || this.states.downSkipstop) {
|
if (this.states.upSkipstop || this.states.downSkipstop) {
|
||||||
this.rectGraphic.stateFillColor = THConsts.trainJump;
|
this.rectGraphic.stateFillColor = THConsts.trainJump;
|
||||||
}
|
}
|
||||||
|
//门的状态
|
||||||
const station =
|
const station =
|
||||||
this.getGraphicApp().queryStore.queryByCodeAndType<THStation>(
|
this.getGraphicApp().queryStore.queryByCodeAndType<THStation>(
|
||||||
this.states.rtuId > 9
|
this.states.rtuId > 9
|
||||||
@ -76,30 +78,29 @@ export class THPlatform extends JlPlatform {
|
|||||||
: '0' + this.states.rtuId,
|
: '0' + this.states.rtuId,
|
||||||
THStation.Type,
|
THStation.Type,
|
||||||
);
|
);
|
||||||
const doorGraphic = this.doorGraphic;
|
this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorGreen;
|
|
||||||
if (!!station?.states.ipRtuStusDown) {
|
if (!!station?.states.ipRtuStusDown) {
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
|
this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorBlue;
|
||||||
} else if (this.states.psdCut) {
|
} else if (this.states.psdCut) {
|
||||||
doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
|
this.doorGraphic.stateFillColor = THConsts.doorGraphic.doorRed;
|
||||||
}
|
}
|
||||||
super.draw();
|
super.draw();
|
||||||
this.doorGraphic.draw();
|
this.doorGraphic.draw();
|
||||||
this.codeGraphic.draw();
|
this.codeGraphic.draw();
|
||||||
this.lozengeGraphic.draw();
|
|
||||||
if (this.datas.direction == 'down') {
|
if (this.datas.direction == 'down') {
|
||||||
this.doorGraphic.changePosition();
|
this.doorGraphic.changePosition();
|
||||||
this.codeGraphic.changePosition();
|
this.codeGraphic.changePosition();
|
||||||
this.lozengeGraphic.changePosition();
|
this.lozengeGraphic.changePosition();
|
||||||
}
|
}
|
||||||
//门的状态
|
//门的显示与隐藏
|
||||||
if (this.datas.hasdoor) {
|
if (this.datas.hasdoor) {
|
||||||
if (this.states.psdOpen) {
|
if (this.states.psdOpen) {
|
||||||
doorGraphic.doorCloseGraphic.visible = false;
|
this.doorGraphic.doorCloseGraphic.visible = false;
|
||||||
} else {
|
} else {
|
||||||
doorGraphic.doorCloseGraphic.visible = true;
|
this.doorGraphic.doorCloseGraphic.visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//紧急停车
|
||||||
if (this.states.emergstop) {
|
if (this.states.emergstop) {
|
||||||
this.lozengeGraphic.lozenge.visible = true;
|
this.lozengeGraphic.lozenge.visible = true;
|
||||||
} else {
|
} else {
|
||||||
@ -113,7 +114,6 @@ export class THPlatform extends JlPlatform {
|
|||||||
this.states.downHold ||
|
this.states.downHold ||
|
||||||
this.states.downOccHold
|
this.states.downOccHold
|
||||||
) {
|
) {
|
||||||
codeGraphic.character.text = 'H';
|
|
||||||
codeGraphic.character.visible = true;
|
codeGraphic.character.visible = true;
|
||||||
codeGraphic.circle.visible = true;
|
codeGraphic.circle.visible = true;
|
||||||
//上行扣车
|
//上行扣车
|
||||||
|
@ -117,34 +117,49 @@ export class CodeGraphic extends Container {
|
|||||||
constructor(platformConsts: PlatformConstsConfig) {
|
constructor(platformConsts: PlatformConstsConfig) {
|
||||||
super();
|
super();
|
||||||
this.platformConsts = platformConsts;
|
this.platformConsts = platformConsts;
|
||||||
this.addChild(this.character);
|
|
||||||
this.addChild(this.runLevel);
|
|
||||||
this.addChild(this.circle);
|
|
||||||
this.addChild(this.stopTime);
|
|
||||||
this.addChild(this.runTime);
|
|
||||||
const codeConsts = platformConsts.codeGraphic as CodeConstsConfig;
|
const codeConsts = platformConsts.codeGraphic as CodeConstsConfig;
|
||||||
this.character.setVectorFontSize(codeConsts.besideFontSize);
|
const childrenGraphics = [
|
||||||
this.runLevel.setVectorFontSize(codeConsts.besideFontSize);
|
this.character,
|
||||||
this.stopTime.setVectorFontSize(codeConsts.besideFontSize);
|
this.runLevel,
|
||||||
this.runTime.setVectorFontSize(codeConsts.besideFontSize);
|
this.runTime,
|
||||||
|
this.stopTime,
|
||||||
|
];
|
||||||
|
childrenGraphics.forEach((child) => {
|
||||||
|
child.setVectorFontSize(codeConsts.besideFontSize);
|
||||||
|
child.anchor.set(0.5);
|
||||||
|
child.style.fill = codeConsts.whiteNumbers;
|
||||||
|
this.addChild(child);
|
||||||
|
});
|
||||||
|
this.addChild(this.circle);
|
||||||
|
this.drawNoChange();
|
||||||
}
|
}
|
||||||
draw(): void {
|
draw(): void {
|
||||||
|
this.character.visible = false;
|
||||||
|
this.circle.visible = false;
|
||||||
|
this.runLevel.visible = false;
|
||||||
|
this.stopTime.visible = false;
|
||||||
|
this.runTime.visible = false;
|
||||||
|
this.position.set(0, 0);
|
||||||
|
}
|
||||||
|
drawNoChange() {
|
||||||
|
const codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig;
|
||||||
|
this.circle
|
||||||
|
.clear()
|
||||||
|
.lineStyle(0.5, codeConsts.whiteCircle)
|
||||||
|
.drawCircle(0, 0, codeConsts.circleRadius);
|
||||||
|
this.character.text = 'H';
|
||||||
|
this.setPosition();
|
||||||
|
}
|
||||||
|
setPosition() {
|
||||||
|
//扣车
|
||||||
const platformConsts = this.platformConsts;
|
const platformConsts = this.platformConsts;
|
||||||
const codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig;
|
const codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig;
|
||||||
//扣车
|
|
||||||
this.character.text = 'H';
|
|
||||||
this.character.anchor.set(0.5);
|
|
||||||
this.character.position.set(
|
this.character.position.set(
|
||||||
-platformConsts.width / 2 -
|
-platformConsts.width / 2 -
|
||||||
platformConsts.lineWidth / 2 -
|
platformConsts.lineWidth / 2 -
|
||||||
(codeConsts.besideSpacing * 2) / 3,
|
(codeConsts.besideSpacing * 2) / 3,
|
||||||
(platformConsts.height * 3) / 4,
|
(platformConsts.height * 3) / 4,
|
||||||
);
|
);
|
||||||
this.character.style.fill = codeConsts.whiteNumbers;
|
|
||||||
this.circle
|
|
||||||
.clear()
|
|
||||||
.lineStyle(0.5, codeConsts.whiteCircle)
|
|
||||||
.drawCircle(0, 0, codeConsts.circleRadius);
|
|
||||||
this.circle.position.set(
|
this.circle.position.set(
|
||||||
-platformConsts.width / 2 -
|
-platformConsts.width / 2 -
|
||||||
platformConsts.lineWidth / 2 -
|
platformConsts.lineWidth / 2 -
|
||||||
@ -152,38 +167,26 @@ export class CodeGraphic extends Container {
|
|||||||
(platformConsts.height * 3) / 5,
|
(platformConsts.height * 3) / 5,
|
||||||
);
|
);
|
||||||
//区间运行等级状态
|
//区间运行等级状态
|
||||||
this.runLevel.anchor.set(0.5);
|
|
||||||
this.runLevel.position.set(
|
this.runLevel.position.set(
|
||||||
platformConsts.width / 2 +
|
platformConsts.width / 2 +
|
||||||
platformConsts.lineWidth / 2 +
|
platformConsts.lineWidth / 2 +
|
||||||
3 * codeConsts.besideSpacing,
|
3 * codeConsts.besideSpacing,
|
||||||
-codeConsts.besideSpacing,
|
-codeConsts.besideSpacing,
|
||||||
);
|
);
|
||||||
this.runLevel.style.fill = codeConsts.whiteNumbers;
|
|
||||||
//区间运行时间
|
//区间运行时间
|
||||||
this.runTime.anchor.set(0.5);
|
|
||||||
this.runTime.position.set(
|
this.runTime.position.set(
|
||||||
platformConsts.width / 2 +
|
platformConsts.width / 2 +
|
||||||
platformConsts.lineWidth / 2 +
|
platformConsts.lineWidth / 2 +
|
||||||
codeConsts.besideSpacing,
|
codeConsts.besideSpacing,
|
||||||
-codeConsts.besideSpacing,
|
-codeConsts.besideSpacing,
|
||||||
);
|
);
|
||||||
this.runTime.style.fill = codeConsts.whiteNumbers;
|
|
||||||
//停站时间
|
//停站时间
|
||||||
this.stopTime.anchor.set(0.5);
|
|
||||||
this.stopTime.position.set(
|
this.stopTime.position.set(
|
||||||
platformConsts.width / 2 +
|
platformConsts.width / 2 +
|
||||||
platformConsts.lineWidth / 2 +
|
platformConsts.lineWidth / 2 +
|
||||||
codeConsts.besideSpacing,
|
codeConsts.besideSpacing,
|
||||||
codeConsts.besideSpacing,
|
codeConsts.besideSpacing,
|
||||||
);
|
);
|
||||||
this.stopTime.style.fill = codeConsts.whiteNumbers;
|
|
||||||
this.character.visible = false;
|
|
||||||
this.circle.visible = false;
|
|
||||||
this.runLevel.visible = false;
|
|
||||||
this.stopTime.visible = false;
|
|
||||||
this.runTime.visible = false;
|
|
||||||
this.position.set(0, 0);
|
|
||||||
}
|
}
|
||||||
changePosition() {
|
changePosition() {
|
||||||
const codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig;
|
const codeConsts = this.platformConsts.codeGraphic as CodeConstsConfig;
|
||||||
@ -218,8 +221,9 @@ export class LozengeGraphic extends Container {
|
|||||||
this.platformConsts = platformConsts;
|
this.platformConsts = platformConsts;
|
||||||
this.lozenge = new Graphics();
|
this.lozenge = new Graphics();
|
||||||
this.addChild(this.lozenge);
|
this.addChild(this.lozenge);
|
||||||
|
this.drawNoChange();
|
||||||
}
|
}
|
||||||
draw(): void {
|
drawNoChange(): void {
|
||||||
const LozengeConsts = this.platformConsts
|
const LozengeConsts = this.platformConsts
|
||||||
.lozengeGraphic as LozengeConstsConfig;
|
.lozengeGraphic as LozengeConstsConfig;
|
||||||
this.lozenge
|
this.lozenge
|
||||||
@ -275,13 +279,12 @@ export class DoorCodeLozenge extends Container {
|
|||||||
this.codeGraphic = new CodeGraphic(this.platformConsts);
|
this.codeGraphic = new CodeGraphic(this.platformConsts);
|
||||||
this.addChild(this.codeGraphic);
|
this.addChild(this.codeGraphic);
|
||||||
}
|
}
|
||||||
draw(hasDoor: boolean, direction: string, platformPos: IPointData) {
|
draw(hasDoor: boolean, direction: string) {
|
||||||
this.doorGraphic.clear();
|
this.doorGraphic.clear();
|
||||||
if (hasDoor) {
|
if (hasDoor) {
|
||||||
this.doorGraphic.draw();
|
this.doorGraphic.draw();
|
||||||
}
|
}
|
||||||
this.codeGraphic.draw();
|
this.codeGraphic.draw();
|
||||||
this.lozengeGraphic.draw();
|
|
||||||
if (direction == 'down') {
|
if (direction == 'down') {
|
||||||
this.doorGraphic.changePosition();
|
this.doorGraphic.changePosition();
|
||||||
this.codeGraphic.changePosition();
|
this.codeGraphic.changePosition();
|
||||||
|
@ -14,6 +14,6 @@ export class GPStation extends JlStation {
|
|||||||
return this.getStates<IGPStationState>();
|
return this.getStates<IGPStationState>();
|
||||||
}
|
}
|
||||||
doRepaint(): void {
|
doRepaint(): void {
|
||||||
super.doRepaint();
|
super.draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,7 @@ export class THStation extends JlStation {
|
|||||||
}
|
}
|
||||||
this.controlGraphic.draw(THConsts);
|
this.controlGraphic.draw(THConsts);
|
||||||
}
|
}
|
||||||
super.doRepaint();
|
super.draw();
|
||||||
|
|
||||||
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();
|
||||||
|
@ -105,6 +105,14 @@ export abstract class JlStation extends JlGraphic {
|
|||||||
this.stationConsts = stationConstsMap.get(
|
this.stationConsts = stationConstsMap.get(
|
||||||
this.styleType,
|
this.styleType,
|
||||||
) as StationConstsConfig;
|
) as StationConstsConfig;
|
||||||
|
this.codeGraph.style.fill = this.stationConsts.codeColor;
|
||||||
|
this.codeGraph.setVectorFontSize(this.stationConsts.codeFontSize);
|
||||||
|
this.codeGraph.anchor.set(0.5);
|
||||||
|
this.kilometerGraph.style.fill = this.stationConsts.kilometerCodeColor;
|
||||||
|
this.kilometerGraph.setVectorFontSize(
|
||||||
|
this.stationConsts.kilometerCodeFontSize,
|
||||||
|
);
|
||||||
|
this.kilometerGraph.anchor.set(0.5);
|
||||||
this.addChild(this.codeGraph);
|
this.addChild(this.codeGraph);
|
||||||
this.addChild(this.kilometerGraph);
|
this.addChild(this.kilometerGraph);
|
||||||
}
|
}
|
||||||
@ -116,26 +124,21 @@ export abstract class JlStation extends JlGraphic {
|
|||||||
return this.datas.code;
|
return this.datas.code;
|
||||||
}
|
}
|
||||||
|
|
||||||
doRepaint(): void {
|
draw(): void {
|
||||||
const codeGraph = this.codeGraph;
|
|
||||||
const kilometerGraph = this.kilometerGraph;
|
|
||||||
switch (this.styleType) {
|
switch (this.styleType) {
|
||||||
case StyleType.TH:
|
case StyleType.TH:
|
||||||
codeGraph.text = this.datas?.code
|
this.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 StyleType.GP:
|
default:
|
||||||
codeGraph.text = this.datas?.code || '车站Station';
|
this.codeGraph.text = this.datas?.code || '车站Station';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
codeGraph.style.fill = this.stationConsts.codeColor;
|
|
||||||
codeGraph.setVectorFontSize(this.stationConsts.codeFontSize);
|
|
||||||
codeGraph.anchor.set(0.5);
|
|
||||||
const kilometerCode = this.datas.kilometerSystem?.kilometer || 12345678;
|
const kilometerCode = this.datas.kilometerSystem?.kilometer || 12345678;
|
||||||
if (Math.floor(kilometerCode * 1000).toString().length > 3) {
|
if (Math.floor(kilometerCode * 1000).toString().length > 3) {
|
||||||
const kiloBit = Math.floor(Number(kilometerCode) / 1000000).toString();
|
const kiloBit = Math.floor(Number(kilometerCode) / 1000000).toString();
|
||||||
kilometerGraph.text =
|
this.kilometerGraph.text =
|
||||||
'K' +
|
'K' +
|
||||||
kiloBit +
|
kiloBit +
|
||||||
'+' +
|
'+' +
|
||||||
@ -143,19 +146,11 @@ export abstract class JlStation extends JlGraphic {
|
|||||||
Number(kilometerCode.toString().substring(kiloBit.length)) / 1000
|
Number(kilometerCode.toString().substring(kiloBit.length)) / 1000
|
||||||
).toFixed(3);
|
).toFixed(3);
|
||||||
} else {
|
} else {
|
||||||
kilometerGraph.text = (kilometerCode * 1000).toFixed(3);
|
this.kilometerGraph.text = (kilometerCode * 1000).toFixed(3);
|
||||||
}
|
|
||||||
kilometerGraph.style.fill = this.stationConsts.kilometerCodeColor;
|
|
||||||
kilometerGraph.setVectorFontSize(this.stationConsts.kilometerCodeFontSize);
|
|
||||||
kilometerGraph.anchor.set(0.5);
|
|
||||||
kilometerGraph.position.set(0, this.stationConsts.kilometerCodeOffsetY);
|
|
||||||
if (this.datas.childTransforms?.length) {
|
|
||||||
this.datas.childTransforms.forEach((child) => {
|
|
||||||
if (child.name == 'kilometer') {
|
|
||||||
const pos = child.transform.position;
|
|
||||||
kilometerGraph.position.set(pos.x, pos.y);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
this.kilometerGraph.position.set(
|
||||||
|
0,
|
||||||
|
this.stationConsts.kilometerCodeOffsetY,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user