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;