From 95aff4919e7d89279b5da0224f3afc21d8473c23 Mon Sep 17 00:00:00 2001 From: Yuan Date: Thu, 20 Jul 2023 09:35:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E6=AE=B5=E5=AD=98=E8=AE=A1=E8=BD=B4?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/section/Section.ts | 21 ++++++++++++-------- src/graphics/section/SectionDrawAssistant.ts | 13 ++++++++---- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/graphics/section/Section.ts b/src/graphics/section/Section.ts index 97d61fb..4f9b6c0 100644 --- a/src/graphics/section/Section.ts +++ b/src/graphics/section/Section.ts @@ -270,6 +270,10 @@ export class Section extends JlGraphic implements ILineGraphic { } else { this.datas.pbRef = undefined; } + const axleCountings = this.relationManage + .getRelationsOfGraphicAndOtherType(this, AxleCounting.Type) + .map((relation) => relation.getOtherGraphic(this).datas.id); + this.datas.axleCountings = axleCountings; } loadRelations() { @@ -291,14 +295,15 @@ export class Section extends JlGraphic implements ILineGraphic { ) ); } - if (this.datas.axleCountings) { - this.datas.axleCountings.forEach((acId) => { - this.relationManage.addRelation( - this, - this.queryStore.queryById(acId) - ); - }); - } + // 由计轴侧load + // if (this.datas.axleCountings) { + // this.datas.axleCountings.forEach((acId) => { + // this.relationManage.addRelation( + // this, + // this.queryStore.queryById(acId) + // ); + // }); + // } } } diff --git a/src/graphics/section/SectionDrawAssistant.ts b/src/graphics/section/SectionDrawAssistant.ts index 42d77b2..25ece82 100644 --- a/src/graphics/section/SectionDrawAssistant.ts +++ b/src/graphics/section/SectionDrawAssistant.ts @@ -180,10 +180,15 @@ export class SectionDraw extends GraphicDrawAssistant< turnoutPhysicalSectionData.code = result.turnouts .map((t) => t.datas.code) .join('-'); - const labelPosition = calculateLineMidpoint( - result.turnouts[0].position, - result.turnouts[1].position - ); + let labelPosition: IPointData; + if (result.turnouts.length === 2) { + labelPosition = calculateLineMidpoint( + result.turnouts[0].position, + result.turnouts[1].position + ); + } else { + labelPosition = { x: result.turnouts[0].x, y: result.turnouts[0].y }; + } labelPosition.y += 20; const labelTransform = GraphicTransform.default(); labelTransform.position = labelPosition;