清空其它线设备的集中站

This commit is contained in:
joylink_zhaoerwei 2023-12-07 18:16:42 +08:00
parent 0fd5aa1382
commit 0f4da5f62b
5 changed files with 108 additions and 51 deletions

View File

@ -26,6 +26,14 @@
@update:model-value="onUpdate" @update:model-value="onUpdate"
label="右边关联的集中站" label="右边关联的集中站"
/> />
<q-toggle
v-model="
concentrationDividingLineModel.isOtherLineConcentrationDividingLine
"
label="是否与其它线的边界处"
emit-value
@update:model-value="onUpdate"
/>
<q-list bordered separator class="rounded-borders"> <q-list bordered separator class="rounded-borders">
<q-item <q-item
v-for="sectionRelation in sectionRelations" v-for="sectionRelation in sectionRelations"
@ -74,6 +82,7 @@ const sectionRelations = computed(() => {
enum devicePort { enum devicePort {
'A', 'A',
'B', 'B',
'C',
} }
const concentrationDividingLine = const concentrationDividingLine =
drawStore.selectedGraphic as ConcentrationDividingLine; drawStore.selectedGraphic as ConcentrationDividingLine;

View File

@ -59,6 +59,12 @@ export class ConcentrationDividingLineData
set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]) { set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]) {
this.data.nodeConWithSecs = nodes; this.data.nodeConWithSecs = nodes;
} }
get isOtherLineConcentrationDividingLine(): boolean {
return this.data.isOtherLineConcentrationDividingLine;
}
set isOtherLineConcentrationDividingLine(v: boolean) {
this.data.isOtherLineConcentrationDividingLine = v;
}
clone(): ConcentrationDividingLineData { clone(): ConcentrationDividingLineData {
return new ConcentrationDividingLineData(this.data.cloneMessage()); return new ConcentrationDividingLineData(this.data.cloneMessage());
} }

View File

@ -25,6 +25,8 @@ export interface IConcentrationDividingLineData extends GraphicData {
set refRightStationId(v: string); set refRightStationId(v: string);
get nodeConWithSecs(): graphicData.NodeConWithSec[]; // 集中区分割线与区段的交点 get nodeConWithSecs(): graphicData.NodeConWithSec[]; // 集中区分割线与区段的交点
set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]); set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]);
get isOtherLineConcentrationDividingLine(): boolean; //集中区分割线绘制在其它线的边界处
set isOtherLineConcentrationDividingLine(v: boolean);
clone(): IConcentrationDividingLineData; clone(): IConcentrationDividingLineData;
copyFrom(data: IConcentrationDividingLineData): void; copyFrom(data: IConcentrationDividingLineData): void;
eq(other: IConcentrationDividingLineData): boolean; eq(other: IConcentrationDividingLineData): boolean;

View File

@ -198,9 +198,11 @@ import {
setUniqueIdPrefix, setUniqueIdPrefix,
creatStationRelateDevice, creatStationRelateDevice,
deleteStationRelateDeviceByType, deleteStationRelateDeviceByType,
loadOtherLineList,
} from 'src/drawApp/commonApp'; } from 'src/drawApp/commonApp';
import { saveJkDrawDatas, loadLinkDatas } from 'src/drawApp/jkApp'; import { saveJkDrawDatas, loadLinkDatas } from 'src/drawApp/jkApp';
import { RelateDevicelistItem, saveThDrawDatas } from 'src/drawApp/thApp'; import { RelateDevicelistItem } from 'src/drawApp/commonApp';
import { saveThDrawDatas } from 'src/drawApp/thApp';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive, ref, watch } from 'vue'; import { onMounted, onUnmounted, reactive, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
@ -268,7 +270,7 @@ import OtherLineList from 'src/components/draw-app/dialogs/OtherLineList.vue';
import OtherLineConfig from 'src/components/draw-app/properties/OtherLineConfig.vue'; import OtherLineConfig from 'src/components/draw-app/properties/OtherLineConfig.vue';
import SectionDirectionConfig from 'src/components/draw-app/properties/SectionDirectionConfig.vue'; import SectionDirectionConfig from 'src/components/draw-app/properties/SectionDirectionConfig.vue';
import SignalDirectionConfig from 'src/components/draw-app/properties/SignalDirectionConfig.vue'; import SignalDirectionConfig from 'src/components/draw-app/properties/SignalDirectionConfig.vue';
import { distance2 } from 'src/jl-graphic'; import { distance2, JlGraphic } from 'src/jl-graphic';
import { Point } from 'pixi.js'; import { Point } from 'pixi.js';
const $q = useQuasar(); const $q = useQuasar();
@ -647,6 +649,7 @@ function oneClickRelateCentralizedStation() {
const drawApp = drawStore.getDrawApp(); const drawApp = drawStore.getDrawApp();
const concentrationDividingLines = drawApp.queryStore const concentrationDividingLines = drawApp.queryStore
.queryByType<ConcentrationDividingLine>(ConcentrationDividingLine.Type) .queryByType<ConcentrationDividingLine>(ConcentrationDividingLine.Type)
.filter((g) => !g.datas.isOtherLineConcentrationDividingLine)
.sort((a, b) => a.datas.points[0].x - b.datas.points[0].x); .sort((a, b) => a.datas.points[0].x - b.datas.points[0].x);
const hasHandleStation: string[] = []; const hasHandleStation: string[] = [];
for (let i = 0; i < concentrationDividingLines.length - 1; i++) { for (let i = 0; i < concentrationDividingLines.length - 1; i++) {
@ -654,7 +657,7 @@ function oneClickRelateCentralizedStation() {
// //
const rightDatas = concentrationDividingLines[i].datas; const rightDatas = concentrationDividingLines[i].datas;
if (hasHandleStation.includes(rightDatas.refRightStationId)) { if (hasHandleStation.includes(rightDatas.refRightStationId)) {
break; continue;
} else { } else {
hasHandleStation.push(rightDatas.refRightStationId); hasHandleStation.push(rightDatas.refRightStationId);
} }
@ -761,6 +764,16 @@ function oneClickRelateCentralizedStation() {
} }
); );
}); });
//线
const otherLineList = loadOtherLineList();
const otherLineListDevice: JlGraphic[] = [];
otherLineList.forEach((otherLine) => {
otherLine.ids.forEach((id) => {
const device = drawApp.queryStore.queryById(id);
otherLineListDevice.push(device);
});
});
handleCentralizedStationsData(otherLineListDevice, []);
function handleNodeConWithSec( function handleNodeConWithSec(
relatedRef: graphicData.RelatedRef, relatedRef: graphicData.RelatedRef,
@ -823,60 +836,64 @@ function oneClickRelateCentralizedStation() {
); );
} }
function handleLeftBoundary(leftBoundary: ConcentrationDividingLine) { function handleLeftBoundary(leftBoundary: ConcentrationDividingLine) {
if (leftBoundary.datas.refLeftStationId) { let containDeviceIds: string[] = [];
let containDeviceIds: string[] = []; const leftSections: {
const leftSections: { section: Section;
section: Section; port: graphicData.RelatedRef.DevicePort;
port: graphicData.RelatedRef.DevicePort; }[] = [];
}[] = []; leftBoundary.datas.nodeConWithSecs.forEach((node) => {
leftBoundary.datas.nodeConWithSecs.forEach((node) => { if (node.leftSection.id !== '') {
if (node.leftSection.id !== '') { leftSections.push({
leftSections.push({ section: drawApp.queryStore.queryById(node.leftSection.id),
section: drawApp.queryStore.queryById(node.leftSection.id), port: node.leftSection.devicePort,
port: node.leftSection.devicePort, });
}); }
} });
}); containDeviceIds = [...leftSections.map((g) => g.section.id)];
containDeviceIds = [...leftSections.map((g) => g.section.id)]; leftSections.forEach((leftSection) => {
leftSections.forEach((leftSection) => { findContainDevice(
findContainDevice( leftSection.section,
leftSection.section, leftSection.port,
leftSection.port, containDeviceIds,
containDeviceIds, drawApp
drawApp );
); containDeviceIds = Array.from(new Set(containDeviceIds));
containDeviceIds = Array.from(new Set(containDeviceIds)); });
}); if (leftBoundary.datas.refLeftStationId == '') {
handleContainDevices(containDeviceIds, []);
} else {
handleContainDevices(containDeviceIds, [ handleContainDevices(containDeviceIds, [
leftBoundary.datas.refLeftStationId, leftBoundary.datas.refLeftStationId,
]); ]);
} }
} }
function handleRightBoundary(rightBoundary: ConcentrationDividingLine) { function handleRightBoundary(rightBoundary: ConcentrationDividingLine) {
if (rightBoundary.datas.refRightStationId) { let containDeviceIds: string[] = [];
let containDeviceIds: string[] = []; const rightSections: {
const rightSections: { section: Section;
section: Section; port: graphicData.RelatedRef.DevicePort;
port: graphicData.RelatedRef.DevicePort; }[] = [];
}[] = []; rightBoundary.datas.nodeConWithSecs.forEach((node) => {
rightBoundary.datas.nodeConWithSecs.forEach((node) => { if (node.rightSection.id !== '') {
if (node.rightSection.id !== '') { rightSections.push({
rightSections.push({ section: drawApp.queryStore.queryById(node.rightSection.id),
section: drawApp.queryStore.queryById(node.rightSection.id), port: node.rightSection.devicePort,
port: node.rightSection.devicePort, });
}); }
} });
}); containDeviceIds = [...rightSections.map((g) => g.section.id)];
containDeviceIds = [...rightSections.map((g) => g.section.id)]; rightSections.forEach((rightSections) => {
rightSections.forEach((rightSections) => { findContainDevice(
findContainDevice( rightSections.section,
rightSections.section, rightSections.port,
rightSections.port, containDeviceIds,
containDeviceIds, drawApp
drawApp );
); containDeviceIds = Array.from(new Set(containDeviceIds));
containDeviceIds = Array.from(new Set(containDeviceIds)); });
}); if (rightBoundary.datas.refRightStationId == '') {
handleContainDevices(containDeviceIds, []);
} else {
handleContainDevices(containDeviceIds, [ handleContainDevices(containDeviceIds, [
rightBoundary.datas.refRightStationId, rightBoundary.datas.refRightStationId,
]); ]);

View File

@ -1698,6 +1698,7 @@ export namespace graphicData {
refLeftStationId?: string; refLeftStationId?: string;
refRightStationId?: string; refRightStationId?: string;
nodeConWithSecs?: NodeConWithSec[]; nodeConWithSecs?: NodeConWithSec[];
isOtherLineConcentrationDividingLine?: boolean;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 6], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 6], this.#one_of_decls);
@ -1720,6 +1721,9 @@ export namespace graphicData {
if ("nodeConWithSecs" in data && data.nodeConWithSecs != undefined) { if ("nodeConWithSecs" in data && data.nodeConWithSecs != undefined) {
this.nodeConWithSecs = data.nodeConWithSecs; this.nodeConWithSecs = data.nodeConWithSecs;
} }
if ("isOtherLineConcentrationDividingLine" in data && data.isOtherLineConcentrationDividingLine != undefined) {
this.isOtherLineConcentrationDividingLine = data.isOtherLineConcentrationDividingLine;
}
} }
} }
get common() { get common() {
@ -1761,6 +1765,12 @@ export namespace graphicData {
set nodeConWithSecs(value: NodeConWithSec[]) { set nodeConWithSecs(value: NodeConWithSec[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value); pb_1.Message.setRepeatedWrapperField(this, 6, value);
} }
get isOtherLineConcentrationDividingLine() {
return pb_1.Message.getFieldWithDefault(this, 7, false) as boolean;
}
set isOtherLineConcentrationDividingLine(value: boolean) {
pb_1.Message.setField(this, 7, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
@ -1768,6 +1778,7 @@ export namespace graphicData {
refLeftStationId?: string; refLeftStationId?: string;
refRightStationId?: string; refRightStationId?: string;
nodeConWithSecs?: ReturnType<typeof NodeConWithSec.prototype.toObject>[]; nodeConWithSecs?: ReturnType<typeof NodeConWithSec.prototype.toObject>[];
isOtherLineConcentrationDividingLine?: boolean;
}): ConcentrationDividingLine { }): ConcentrationDividingLine {
const message = new ConcentrationDividingLine({}); const message = new ConcentrationDividingLine({});
if (data.common != null) { if (data.common != null) {
@ -1788,6 +1799,9 @@ export namespace graphicData {
if (data.nodeConWithSecs != null) { if (data.nodeConWithSecs != null) {
message.nodeConWithSecs = data.nodeConWithSecs.map(item => NodeConWithSec.fromObject(item)); message.nodeConWithSecs = data.nodeConWithSecs.map(item => NodeConWithSec.fromObject(item));
} }
if (data.isOtherLineConcentrationDividingLine != null) {
message.isOtherLineConcentrationDividingLine = data.isOtherLineConcentrationDividingLine;
}
return message; return message;
} }
toObject() { toObject() {
@ -1798,6 +1812,7 @@ export namespace graphicData {
refLeftStationId?: string; refLeftStationId?: string;
refRightStationId?: string; refRightStationId?: string;
nodeConWithSecs?: ReturnType<typeof NodeConWithSec.prototype.toObject>[]; nodeConWithSecs?: ReturnType<typeof NodeConWithSec.prototype.toObject>[];
isOtherLineConcentrationDividingLine?: boolean;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -1817,6 +1832,9 @@ export namespace graphicData {
if (this.nodeConWithSecs != null) { if (this.nodeConWithSecs != null) {
data.nodeConWithSecs = this.nodeConWithSecs.map((item: NodeConWithSec) => item.toObject()); data.nodeConWithSecs = this.nodeConWithSecs.map((item: NodeConWithSec) => item.toObject());
} }
if (this.isOtherLineConcentrationDividingLine != null) {
data.isOtherLineConcentrationDividingLine = this.isOtherLineConcentrationDividingLine;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -1835,6 +1853,8 @@ export namespace graphicData {
writer.writeString(5, this.refRightStationId); writer.writeString(5, this.refRightStationId);
if (this.nodeConWithSecs.length) if (this.nodeConWithSecs.length)
writer.writeRepeatedMessage(6, this.nodeConWithSecs, (item: NodeConWithSec) => item.serialize(writer)); writer.writeRepeatedMessage(6, this.nodeConWithSecs, (item: NodeConWithSec) => item.serialize(writer));
if (this.isOtherLineConcentrationDividingLine != false)
writer.writeBool(7, this.isOtherLineConcentrationDividingLine);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1862,6 +1882,9 @@ export namespace graphicData {
case 6: case 6:
reader.readMessage(message.nodeConWithSecs, () => pb_1.Message.addToRepeatedWrapperField(message, 6, NodeConWithSec.deserialize(reader), NodeConWithSec)); reader.readMessage(message.nodeConWithSecs, () => pb_1.Message.addToRepeatedWrapperField(message, 6, NodeConWithSec.deserialize(reader), NodeConWithSec));
break; break;
case 7:
message.isOtherLineConcentrationDividingLine = reader.readBool();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }