增加指定的道岔组不生成计轴

This commit is contained in:
joylink_zhaoerwei 2023-11-10 17:15:22 +08:00
parent b7ebddaaad
commit 7a8b5c2eb4
3 changed files with 57 additions and 2 deletions

View File

@ -92,6 +92,12 @@ const axleCountingConfig = ref<{
refTurnoutCode: [], refTurnoutCode: [],
expanded: false, expanded: false,
}, },
{
code: '不生成计轴的道岔组',
refTurnout: [],
refTurnoutCode: [],
expanded: false,
},
], ],
}); });
@ -126,6 +132,12 @@ onMounted(() => {
const g = drawStore.getDrawApp().queryStore.queryById(id); const g = drawStore.getDrawApp().queryStore.queryById(id);
generate.refTurnoutCode.push(g.code); generate.refTurnoutCode.push(g.code);
}); });
} else if (generate.code == '不生成计轴的道岔组') {
generate.refTurnout = generateAxleCountingConfig.noGenerateGroup;
generateAxleCountingConfig.noGenerateGroup.forEach((id) => {
const g = drawStore.getDrawApp().queryStore.queryById(id);
generate.refTurnoutCode.push(g.code);
});
} }
}); });
} }
@ -141,6 +153,8 @@ async function onSubmit() {
axleCountingConfig.value.generate.forEach((generate) => { axleCountingConfig.value.generate.forEach((generate) => {
if (generate.code == 'bb连接的道岔') { if (generate.code == 'bb连接的道岔') {
generateAxleCountingConfig.bbConnect = generate.refTurnout; generateAxleCountingConfig.bbConnect = generate.refTurnout;
} else if (generate.code == '不生成计轴的道岔组') {
generateAxleCountingConfig.noGenerateGroup = generate.refTurnout;
} }
}); });
setGenerateAxleCountingConfig(generateAxleCountingConfig); setGenerateAxleCountingConfig(generateAxleCountingConfig);

View File

@ -80,6 +80,25 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
refGraphic: Section | Turnout, refGraphic: Section | Turnout,
refPort: TurnoutPort | SectionPort refPort: TurnoutPort | SectionPort
) { ) {
const generateAxleCountingConfig = loadGenerateAxleCountingConfig();
let hasNoGenerateGroup = false;
if (generateAxleCountingConfig?.noGenerateGroup !== undefined) {
const noGenerateGroup = generateAxleCountingConfig.noGenerateGroup;
for (let i = 0; i < noGenerateGroup.length; i++) {
if (
noGenerateGroup[i] == graphic.id &&
((i % 2 == 0 && refGraphic.id == noGenerateGroup[i + 1]) ||
(i % 2 == 1 && refGraphic.id == noGenerateGroup[i - 1]))
) {
hasNoGenerateGroup = true;
}
}
}
if (hasNoGenerateGroup) {
map.set(`${graphic.id}-${port}`, 1);
map.set(`${refGraphic.id}-${refPort}`, 1);
return;
}
if ( if (
graphic.type == 'Turnout' && graphic.type == 'Turnout' &&
reftype == 'Turnout' && reftype == 'Turnout' &&
@ -88,7 +107,6 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
) { ) {
//查看生成计轴bb配置 //查看生成计轴bb配置
let hasBB = false; let hasBB = false;
const generateAxleCountingConfig = loadGenerateAxleCountingConfig();
if (generateAxleCountingConfig !== undefined) { if (generateAxleCountingConfig !== undefined) {
const bbConnect = generateAxleCountingConfig.bbConnect; const bbConnect = generateAxleCountingConfig.bbConnect;
if ( if (

View File

@ -2436,13 +2436,17 @@ export namespace graphicData {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
bbConnect?: string[]; bbConnect?: string[];
noGenerateGroup?: string[];
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("bbConnect" in data && data.bbConnect != undefined) { if ("bbConnect" in data && data.bbConnect != undefined) {
this.bbConnect = data.bbConnect; this.bbConnect = data.bbConnect;
} }
if ("noGenerateGroup" in data && data.noGenerateGroup != undefined) {
this.noGenerateGroup = data.noGenerateGroup;
}
} }
} }
get bbConnect() { get bbConnect() {
@ -2451,22 +2455,36 @@ export namespace graphicData {
set bbConnect(value: string[]) { set bbConnect(value: string[]) {
pb_1.Message.setField(this, 1, value); pb_1.Message.setField(this, 1, value);
} }
get noGenerateGroup() {
return pb_1.Message.getFieldWithDefault(this, 2, []) as string[];
}
set noGenerateGroup(value: string[]) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: { static fromObject(data: {
bbConnect?: string[]; bbConnect?: string[];
noGenerateGroup?: string[];
}): GenerateAxleCountingConfig { }): GenerateAxleCountingConfig {
const message = new GenerateAxleCountingConfig({}); const message = new GenerateAxleCountingConfig({});
if (data.bbConnect != null) { if (data.bbConnect != null) {
message.bbConnect = data.bbConnect; message.bbConnect = data.bbConnect;
} }
if (data.noGenerateGroup != null) {
message.noGenerateGroup = data.noGenerateGroup;
}
return message; return message;
} }
toObject() { toObject() {
const data: { const data: {
bbConnect?: string[]; bbConnect?: string[];
noGenerateGroup?: string[];
} = {}; } = {};
if (this.bbConnect != null) { if (this.bbConnect != null) {
data.bbConnect = this.bbConnect; data.bbConnect = this.bbConnect;
} }
if (this.noGenerateGroup != null) {
data.noGenerateGroup = this.noGenerateGroup;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -2475,6 +2493,8 @@ export namespace graphicData {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.bbConnect.length) if (this.bbConnect.length)
writer.writeRepeatedString(1, this.bbConnect); writer.writeRepeatedString(1, this.bbConnect);
if (this.noGenerateGroup.length)
writer.writeRepeatedString(2, this.noGenerateGroup);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -2487,6 +2507,9 @@ export namespace graphicData {
case 1: case 1:
pb_1.Message.addToRepeatedField(message, 1, reader.readString()); pb_1.Message.addToRepeatedField(message, 1, reader.readString());
break; break;
case 2:
pb_1.Message.addToRepeatedField(message, 2, reader.readString());
break;
default: reader.skipField(); default: reader.skipField();
} }
} }