From 0f4da5f62bede8847725cb7a66e02cc2d6452bda Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Thu, 7 Dec 2023 18:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=85=B6=E5=AE=83=E7=BA=BF?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=9A=84=E9=9B=86=E4=B8=AD=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConcentrationDividingLineProperty.vue | 9 ++ .../ConcentrationDividingLineInteraction.ts | 6 + .../ConcentrationDividingLine.ts | 2 + src/layouts/DrawLayout.vue | 119 ++++++++++-------- src/protos/stationLayoutGraphics.ts | 23 ++++ 5 files changed, 108 insertions(+), 51 deletions(-) diff --git a/src/components/draw-app/properties/ConcentrationDividingLineProperty.vue b/src/components/draw-app/properties/ConcentrationDividingLineProperty.vue index 1d6adfd..d837011 100644 --- a/src/components/draw-app/properties/ConcentrationDividingLineProperty.vue +++ b/src/components/draw-app/properties/ConcentrationDividingLineProperty.vue @@ -26,6 +26,14 @@ @update:model-value="onUpdate" label="右边关联的集中站" /> + { enum devicePort { 'A', 'B', + 'C', } const concentrationDividingLine = drawStore.selectedGraphic as ConcentrationDividingLine; diff --git a/src/drawApp/graphics/ConcentrationDividingLineInteraction.ts b/src/drawApp/graphics/ConcentrationDividingLineInteraction.ts index f32b39c..59e792b 100644 --- a/src/drawApp/graphics/ConcentrationDividingLineInteraction.ts +++ b/src/drawApp/graphics/ConcentrationDividingLineInteraction.ts @@ -59,6 +59,12 @@ export class ConcentrationDividingLineData set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]) { this.data.nodeConWithSecs = nodes; } + get isOtherLineConcentrationDividingLine(): boolean { + return this.data.isOtherLineConcentrationDividingLine; + } + set isOtherLineConcentrationDividingLine(v: boolean) { + this.data.isOtherLineConcentrationDividingLine = v; + } clone(): ConcentrationDividingLineData { return new ConcentrationDividingLineData(this.data.cloneMessage()); } diff --git a/src/graphics/concentrationDividingLine/ConcentrationDividingLine.ts b/src/graphics/concentrationDividingLine/ConcentrationDividingLine.ts index 679e1c5..36bbfa2 100644 --- a/src/graphics/concentrationDividingLine/ConcentrationDividingLine.ts +++ b/src/graphics/concentrationDividingLine/ConcentrationDividingLine.ts @@ -25,6 +25,8 @@ export interface IConcentrationDividingLineData extends GraphicData { set refRightStationId(v: string); get nodeConWithSecs(): graphicData.NodeConWithSec[]; // 集中区分割线与区段的交点 set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]); + get isOtherLineConcentrationDividingLine(): boolean; //集中区分割线绘制在其它线的边界处 + set isOtherLineConcentrationDividingLine(v: boolean); clone(): IConcentrationDividingLineData; copyFrom(data: IConcentrationDividingLineData): void; eq(other: IConcentrationDividingLineData): boolean; diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index f7f69d1..a5f3561 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -198,9 +198,11 @@ import { setUniqueIdPrefix, creatStationRelateDevice, deleteStationRelateDeviceByType, + loadOtherLineList, } from 'src/drawApp/commonApp'; 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 { onMounted, onUnmounted, reactive, ref, watch } from 'vue'; 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 SectionDirectionConfig from 'src/components/draw-app/properties/SectionDirectionConfig.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'; const $q = useQuasar(); @@ -647,6 +649,7 @@ function oneClickRelateCentralizedStation() { const drawApp = drawStore.getDrawApp(); const concentrationDividingLines = drawApp.queryStore .queryByType(ConcentrationDividingLine.Type) + .filter((g) => !g.datas.isOtherLineConcentrationDividingLine) .sort((a, b) => a.datas.points[0].x - b.datas.points[0].x); const hasHandleStation: string[] = []; for (let i = 0; i < concentrationDividingLines.length - 1; i++) { @@ -654,7 +657,7 @@ function oneClickRelateCentralizedStation() { //右边 const rightDatas = concentrationDividingLines[i].datas; if (hasHandleStation.includes(rightDatas.refRightStationId)) { - break; + continue; } else { 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( relatedRef: graphicData.RelatedRef, @@ -823,60 +836,64 @@ function oneClickRelateCentralizedStation() { ); } function handleLeftBoundary(leftBoundary: ConcentrationDividingLine) { - if (leftBoundary.datas.refLeftStationId) { - let containDeviceIds: string[] = []; - const leftSections: { - section: Section; - port: graphicData.RelatedRef.DevicePort; - }[] = []; - leftBoundary.datas.nodeConWithSecs.forEach((node) => { - if (node.leftSection.id !== '') { - leftSections.push({ - section: drawApp.queryStore.queryById(node.leftSection.id), - port: node.leftSection.devicePort, - }); - } - }); - containDeviceIds = [...leftSections.map((g) => g.section.id)]; - leftSections.forEach((leftSection) => { - findContainDevice( - leftSection.section, - leftSection.port, - containDeviceIds, - drawApp - ); - containDeviceIds = Array.from(new Set(containDeviceIds)); - }); + let containDeviceIds: string[] = []; + const leftSections: { + section: Section; + port: graphicData.RelatedRef.DevicePort; + }[] = []; + leftBoundary.datas.nodeConWithSecs.forEach((node) => { + if (node.leftSection.id !== '') { + leftSections.push({ + section: drawApp.queryStore.queryById(node.leftSection.id), + port: node.leftSection.devicePort, + }); + } + }); + containDeviceIds = [...leftSections.map((g) => g.section.id)]; + leftSections.forEach((leftSection) => { + findContainDevice( + leftSection.section, + leftSection.port, + containDeviceIds, + drawApp + ); + containDeviceIds = Array.from(new Set(containDeviceIds)); + }); + if (leftBoundary.datas.refLeftStationId == '') { + handleContainDevices(containDeviceIds, []); + } else { handleContainDevices(containDeviceIds, [ leftBoundary.datas.refLeftStationId, ]); } } function handleRightBoundary(rightBoundary: ConcentrationDividingLine) { - if (rightBoundary.datas.refRightStationId) { - let containDeviceIds: string[] = []; - const rightSections: { - section: Section; - port: graphicData.RelatedRef.DevicePort; - }[] = []; - rightBoundary.datas.nodeConWithSecs.forEach((node) => { - if (node.rightSection.id !== '') { - rightSections.push({ - section: drawApp.queryStore.queryById(node.rightSection.id), - port: node.rightSection.devicePort, - }); - } - }); - containDeviceIds = [...rightSections.map((g) => g.section.id)]; - rightSections.forEach((rightSections) => { - findContainDevice( - rightSections.section, - rightSections.port, - containDeviceIds, - drawApp - ); - containDeviceIds = Array.from(new Set(containDeviceIds)); - }); + let containDeviceIds: string[] = []; + const rightSections: { + section: Section; + port: graphicData.RelatedRef.DevicePort; + }[] = []; + rightBoundary.datas.nodeConWithSecs.forEach((node) => { + if (node.rightSection.id !== '') { + rightSections.push({ + section: drawApp.queryStore.queryById(node.rightSection.id), + port: node.rightSection.devicePort, + }); + } + }); + containDeviceIds = [...rightSections.map((g) => g.section.id)]; + rightSections.forEach((rightSections) => { + findContainDevice( + rightSections.section, + rightSections.port, + containDeviceIds, + drawApp + ); + containDeviceIds = Array.from(new Set(containDeviceIds)); + }); + if (rightBoundary.datas.refRightStationId == '') { + handleContainDevices(containDeviceIds, []); + } else { handleContainDevices(containDeviceIds, [ rightBoundary.datas.refRightStationId, ]); diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index 89b4bc7..ff3618c 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -1698,6 +1698,7 @@ export namespace graphicData { refLeftStationId?: string; refRightStationId?: string; nodeConWithSecs?: NodeConWithSec[]; + isOtherLineConcentrationDividingLine?: boolean; }) { super(); 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) { this.nodeConWithSecs = data.nodeConWithSecs; } + if ("isOtherLineConcentrationDividingLine" in data && data.isOtherLineConcentrationDividingLine != undefined) { + this.isOtherLineConcentrationDividingLine = data.isOtherLineConcentrationDividingLine; + } } } get common() { @@ -1761,6 +1765,12 @@ export namespace graphicData { set nodeConWithSecs(value: NodeConWithSec[]) { 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: { common?: ReturnType; code?: string; @@ -1768,6 +1778,7 @@ export namespace graphicData { refLeftStationId?: string; refRightStationId?: string; nodeConWithSecs?: ReturnType[]; + isOtherLineConcentrationDividingLine?: boolean; }): ConcentrationDividingLine { const message = new ConcentrationDividingLine({}); if (data.common != null) { @@ -1788,6 +1799,9 @@ export namespace graphicData { if (data.nodeConWithSecs != null) { message.nodeConWithSecs = data.nodeConWithSecs.map(item => NodeConWithSec.fromObject(item)); } + if (data.isOtherLineConcentrationDividingLine != null) { + message.isOtherLineConcentrationDividingLine = data.isOtherLineConcentrationDividingLine; + } return message; } toObject() { @@ -1798,6 +1812,7 @@ export namespace graphicData { refLeftStationId?: string; refRightStationId?: string; nodeConWithSecs?: ReturnType[]; + isOtherLineConcentrationDividingLine?: boolean; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -1817,6 +1832,9 @@ export namespace graphicData { if (this.nodeConWithSecs != null) { data.nodeConWithSecs = this.nodeConWithSecs.map((item: NodeConWithSec) => item.toObject()); } + if (this.isOtherLineConcentrationDividingLine != null) { + data.isOtherLineConcentrationDividingLine = this.isOtherLineConcentrationDividingLine; + } return data; } serialize(): Uint8Array; @@ -1835,6 +1853,8 @@ export namespace graphicData { writer.writeString(5, this.refRightStationId); if (this.nodeConWithSecs.length) writer.writeRepeatedMessage(6, this.nodeConWithSecs, (item: NodeConWithSec) => item.serialize(writer)); + if (this.isOtherLineConcentrationDividingLine != false) + writer.writeBool(7, this.isOtherLineConcentrationDividingLine); if (!w) return writer.getResultBuffer(); } @@ -1862,6 +1882,9 @@ export namespace graphicData { case 6: reader.readMessage(message.nodeConWithSecs, () => pb_1.Message.addToRepeatedWrapperField(message, 6, NodeConWithSec.deserialize(reader), NodeConWithSec)); break; + case 7: + message.isOtherLineConcentrationDividingLine = reader.readBool(); + break; default: reader.skipField(); } }