From b274d205256edfca25dc93e43c01e44da287aaff Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Fri, 1 Dec 2023 16:31:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87=E9=9B=86=E4=B8=AD=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E5=89=B2=E7=BA=BF=E4=B8=80=E9=94=AE=E5=85=B3=E8=81=94?= =?UTF-8?q?=E9=9B=86=E4=B8=AD=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/multipleSelectProperty.vue | 60 +++++++++++++++++-- .../ConcentrationDividingLine.ts | 11 +++- 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/src/components/draw-app/properties/multipleSelectProperty.vue b/src/components/draw-app/properties/multipleSelectProperty.vue index 77b8856..56cfcb9 100644 --- a/src/components/draw-app/properties/multipleSelectProperty.vue +++ b/src/components/draw-app/properties/multipleSelectProperty.vue @@ -649,13 +649,61 @@ function oneClickRelateCentralizedStation() { containDeviceIds = Array.from(new Set(containDeviceIds)); }); - const containDevices = containDeviceIds.map((id) => { - return drawApp.queryStore.queryById(id); - }); - handleCentralizedStationsData(containDevices, [ - rightDatas.refRightStationId, - ]); + if (rightDatas.refRightStationId) { + const containDevices = containDeviceIds.map((id) => { + return drawApp.queryStore.queryById(id); + }); + const signals = drawApp.queryStore + .queryByType(Signal.Type) + .filter((g) => containDeviceIds.includes(g.datas.refDev.id)); + const transponders = drawApp.queryStore + .queryByType(Transponder.Type) + .filter((g) => containDeviceIds.includes(g.datas.TransponderRef.id)); + const axleCountings = drawApp.queryStore + .queryByType(AxleCounting.Type) + .filter((g) => { + const axleCountingRefId = g.datas.axleCountingRef.map( + (ref) => ref.id + ); + if ( + findCommonElements([axleCountingRefId, containDeviceIds]).length + ) { + return true; + } + return false; + }); + const allSetCentralizedStationsDevice = [ + ...containDevices, + ...signals, + ...transponders, + ...axleCountings, + ]; + allSetCentralizedStationsDevice.forEach( + (g) => ((g as Signal).datas.centralizedStations = []) + ); + handleCentralizedStationsData(allSetCentralizedStationsDevice, [ + rightDatas.refRightStationId, + ]); + } } + //区段边界的计轴单独处理 + const axleCountings = drawApp.queryStore + .queryByType(AxleCounting.Type) + .filter( + (g) => + g.datas.type == + graphicData.AxleCounting.TypeDetectionPoint.SectionBoundary + ); + axleCountings.forEach((g) => { + if (g.datas.axleCountingRef.length == 2) { + const centralizedStations: string[] = []; + g.datas.axleCountingRef.forEach((ref) => { + const section = drawApp.queryStore.queryById
(ref.id); + centralizedStations.push(...section.datas.centralizedStations); + }); + g.datas.centralizedStations = Array.from(new Set(centralizedStations)); + } + }); } //相同的编号后缀-道岔、信号机、区段 diff --git a/src/graphics/concentrationDividingLine/ConcentrationDividingLine.ts b/src/graphics/concentrationDividingLine/ConcentrationDividingLine.ts index db39bf8..167e5e5 100644 --- a/src/graphics/concentrationDividingLine/ConcentrationDividingLine.ts +++ b/src/graphics/concentrationDividingLine/ConcentrationDividingLine.ts @@ -4,6 +4,7 @@ import { JlGraphic, JlGraphicTemplate, calculateDistanceFromPointToLine, + getRectangleCenter, } from 'src/jl-graphic'; import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin'; import { SectionGraphic } from '../sectionGraphic/SectionGraphic'; @@ -133,11 +134,17 @@ export class ConcentrationDividingLine nodeConWithSecs.sort((a, b) => { const sectionAId = a.leftSectionId !== '' ? a.leftSectionId : a.rightSectionId; + const sectionA = this.queryStore.queryById
(sectionAId); const sectionBId = b.leftSectionId !== '' ? b.leftSectionId : b.rightSectionId; + const sectionB = this.queryStore.queryById
(sectionBId); return ( - this.queryStore.queryById
(sectionAId).position.y - - this.queryStore.queryById
(sectionBId).position.y + sectionA.localToCanvasPoint( + getRectangleCenter(sectionA.getLocalBounds()) + ).y - + sectionB.localToCanvasPoint( + getRectangleCenter(sectionB.getLocalBounds()) + ).y ); }); this.datas.nodeConWithSecs = nodeConWithSecs;