上下行字段修改

This commit is contained in:
joylink_zhaoerwei 2023-07-21 10:03:17 +08:00
parent 31eab6eb9c
commit ff8a34479c
5 changed files with 52 additions and 41 deletions

View File

@ -67,16 +67,20 @@ enum showSelect {
= 'false',
向上 = 'up',
向下 = 'down',
上行 = 'upLink',
下行 = 'downLink',
}
enum showUp {
上行 = 'true',
下行 = 'false',
}
enum showSelectData {
true = '是',
false = '否',
up = '向上',
down = '向下',
upLink = '上行',
downLink = '下行',
}
enum showUpData {
true = '上行',
false = '下行',
}
drawStore.$subscribe;
@ -87,7 +91,7 @@ watch(
platformModel.copyFrom(val.saveData() as PlatformData);
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
direction.value = (showSelectData as never)[platformModel.direction];
upAndDown.value = (showSelectData as never)[platformModel.upAndDown];
upAndDown.value = (showUpData as never)[platformModel.up + ''];
if (platformModel.refStation) {
const refStation = val.queryStore.queryById<Station>(
platformModel.refStation
@ -104,7 +108,7 @@ onMounted(() => {
platformModel.copyFrom(platform.saveData());
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
direction.value = (showSelectData as never)[platformModel.direction];
upAndDown.value = (showSelectData as never)[platformModel.upAndDown];
upAndDown.value = (showUpData as never)[platformModel.up + ''];
if (platformModel.refStation) {
const refStation = platform.queryStore.queryById<Station>(
platformModel.refStation
@ -117,7 +121,7 @@ onMounted(() => {
function onUpdate() {
platformModel.hasdoor = JSON.parse((showSelect as never)[hasDoor.value]);
platformModel.direction = (showSelect as never)[direction.value];
platformModel.upAndDown = (showSelect as never)[upAndDown.value];
platformModel.up = JSON.parse((showUp as never)[upAndDown.value]);
const platform = drawStore.selectedGraphic as Platform;
if (platform) {
drawStore.getDrawApp().updateGraphicAndRecord(platform, platformModel);

View File

@ -53,11 +53,11 @@ export class PlatformData extends GraphicDataBase implements IPlatformData {
set direction(v: string) {
this.data.direction = v;
}
get upAndDown(): string {
return this.data.upAndDown;
get up(): boolean {
return this.data.up;
}
set upAndDown(v: string) {
this.data.upAndDown = v;
set up(v: boolean) {
this.data.up = v;
}
get refStation(): string {
return this.data.refStation;

View File

@ -17,8 +17,8 @@ export interface IPlatformData extends GraphicData {
set hasdoor(v: boolean);
get direction(): string; // 屏蔽门上下
set direction(v: string);
get upAndDown(): string; // 站台上下行
set upAndDown(v: string);
get up(): boolean; // 站台上下行
set up(v: boolean);
get refStation(): string; // 关联的车站
set refStation(v: string);
clone(): IPlatformData;

View File

@ -19,6 +19,7 @@ import {
import { Section, SectionType } from '../section/Section';
import { LogicSection } from '../logicSection/LogicSection';
import { Platform } from '../platform/Platform';
import { Turnout } from '../turnout/Turnout';
function graphicsOverlap(
x1: number,
@ -135,13 +136,19 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
trainWindow.loadData(this.graphicTemplate.datas);
if (section.type == 'LogicSection') {
trainWindow.datas.refDeviceId = [section.id];
trainWindow.position.set(
x,
ps.y - direction * TrainWindowConsts.offsetSection
);
} else {
trainWindow.datas.refDeviceId = (section as Section).datas.children;
const refTurnout = (section as Section).datas.children;
trainWindow.datas.refDeviceId = refTurnout;
const turnout = this.app.queryStore.queryById<Turnout>(refTurnout[0]);
trainWindow.position.set(
x,
turnout.y - direction * TrainWindowConsts.offsetSection
);
}
trainWindow.position.set(
x,
ps.y - direction * TrainWindowConsts.offsetSection
);
trainWindow.id = GraphicIdGenerator.next();
this.storeGraphic(trainWindow);
const platforms = this.app.queryStore.queryByType<Platform>(Platform.Type);

View File

@ -1706,8 +1706,8 @@ export namespace graphicData {
code?: string;
hasdoor?: boolean;
direction?: string;
upAndDown?: string;
refStation?: string;
up?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -1724,12 +1724,12 @@ export namespace graphicData {
if ("direction" in data && data.direction != undefined) {
this.direction = data.direction;
}
if ("upAndDown" in data && data.upAndDown != undefined) {
this.upAndDown = data.upAndDown;
}
if ("refStation" in data && data.refStation != undefined) {
this.refStation = data.refStation;
}
if ("up" in data && data.up != undefined) {
this.up = data.up;
}
}
}
get common() {
@ -1759,25 +1759,25 @@ export namespace graphicData {
set direction(value: string) {
pb_1.Message.setField(this, 4, value);
}
get upAndDown() {
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
}
set upAndDown(value: string) {
pb_1.Message.setField(this, 5, value);
}
get refStation() {
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
}
set refStation(value: string) {
pb_1.Message.setField(this, 6, value);
}
get up() {
return pb_1.Message.getFieldWithDefault(this, 7, false) as boolean;
}
set up(value: boolean) {
pb_1.Message.setField(this, 7, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
hasdoor?: boolean;
direction?: string;
upAndDown?: string;
refStation?: string;
up?: boolean;
}): Platform {
const message = new Platform({});
if (data.common != null) {
@ -1792,12 +1792,12 @@ export namespace graphicData {
if (data.direction != null) {
message.direction = data.direction;
}
if (data.upAndDown != null) {
message.upAndDown = data.upAndDown;
}
if (data.refStation != null) {
message.refStation = data.refStation;
}
if (data.up != null) {
message.up = data.up;
}
return message;
}
toObject() {
@ -1806,8 +1806,8 @@ export namespace graphicData {
code?: string;
hasdoor?: boolean;
direction?: string;
upAndDown?: string;
refStation?: string;
up?: boolean;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -1821,12 +1821,12 @@ export namespace graphicData {
if (this.direction != null) {
data.direction = this.direction;
}
if (this.upAndDown != null) {
data.upAndDown = this.upAndDown;
}
if (this.refStation != null) {
data.refStation = this.refStation;
}
if (this.up != null) {
data.up = this.up;
}
return data;
}
serialize(): Uint8Array;
@ -1841,10 +1841,10 @@ export namespace graphicData {
writer.writeBool(3, this.hasdoor);
if (this.direction.length)
writer.writeString(4, this.direction);
if (this.upAndDown.length)
writer.writeString(5, this.upAndDown);
if (this.refStation.length)
writer.writeString(6, this.refStation);
if (this.up != false)
writer.writeBool(7, this.up);
if (!w)
return writer.getResultBuffer();
}
@ -1866,12 +1866,12 @@ export namespace graphicData {
case 4:
message.direction = reader.readString();
break;
case 5:
message.upAndDown = reader.readString();
break;
case 6:
message.refStation = reader.readString();
break;
case 7:
message.up = reader.readBool();
break;
default: reader.skipField();
}
}