道岔物理区段增加道岔数据

This commit is contained in:
Yuan 2023-07-19 09:00:52 +08:00
parent 37be5d34d8
commit bfbf3c6f00
3 changed files with 23 additions and 19 deletions

View File

@ -147,8 +147,9 @@ export class SectionDraw extends GraphicDrawAssistant<
} else {
const nextTurnout = currentPortRelated.find(
(graphic) => graphic instanceof Turnout
) as Turnout;
const result = dfs(nextTurnout);
);
if (!nextTurnout) return;
const result = dfs(nextTurnout as Turnout);
if (result?.axleCountings) {
axleCountings.push(...result.axleCountings);
turnouts.push(...result.turnouts);
@ -175,6 +176,9 @@ export class SectionDraw extends GraphicDrawAssistant<
turnoutPhysicalSectionData.axleCountings = result.axleCountings.map(
(ac) => ac.datas.id
);
turnoutPhysicalSectionData.children = result.turnouts.map(
(t) => t.datas.id
);
turnoutPhysicalSectionData.code = 'DG000';
let labelPosition: IPointData;
if (result.turnouts.length === 2) {

View File

@ -2147,10 +2147,10 @@ export namespace graphicData {
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
sectionId?: string;
refDeviceId?: string[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@ -2158,8 +2158,8 @@ export namespace graphicData {
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("sectionId" in data && data.sectionId != undefined) {
this.sectionId = data.sectionId;
if ("refDeviceId" in data && data.refDeviceId != undefined) {
this.refDeviceId = data.refDeviceId;
}
}
}
@ -2178,16 +2178,16 @@ export namespace graphicData {
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
get sectionId() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
get refDeviceId() {
return pb_1.Message.getFieldWithDefault(this, 3, []) as string[];
}
set sectionId(value: string) {
set refDeviceId(value: string[]) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
sectionId?: string;
refDeviceId?: string[];
}): TrainWindow {
const message = new TrainWindow({});
if (data.common != null) {
@ -2196,8 +2196,8 @@ export namespace graphicData {
if (data.code != null) {
message.code = data.code;
}
if (data.sectionId != null) {
message.sectionId = data.sectionId;
if (data.refDeviceId != null) {
message.refDeviceId = data.refDeviceId;
}
return message;
}
@ -2205,7 +2205,7 @@ export namespace graphicData {
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
sectionId?: string;
refDeviceId?: string[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -2213,8 +2213,8 @@ export namespace graphicData {
if (this.code != null) {
data.code = this.code;
}
if (this.sectionId != null) {
data.sectionId = this.sectionId;
if (this.refDeviceId != null) {
data.refDeviceId = this.refDeviceId;
}
return data;
}
@ -2226,8 +2226,8 @@ export namespace graphicData {
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.sectionId.length)
writer.writeString(3, this.sectionId);
if (this.refDeviceId.length)
writer.writeRepeatedString(3, this.refDeviceId);
if (!w)
return writer.getResultBuffer();
}
@ -2244,7 +2244,7 @@ export namespace graphicData {
message.code = reader.readString();
break;
case 3:
message.sectionId = reader.readString();
pb_1.Message.addToRepeatedField(message, 3, reader.readString());
break;
default: reader.skipField();
}

@ -1 +1 @@
Subproject commit 84796ff001d83d654aff20fb719db04531fbb8ea
Subproject commit 2d6ac2275e77c2bcdf88ab8fed00690b3e956ac4