区段存计轴数据

This commit is contained in:
Yuan 2023-07-20 09:35:27 +08:00
parent e85c27aefb
commit 95aff4919e
2 changed files with 22 additions and 12 deletions

View File

@ -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<AxleCounting>(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<AxleCounting>(acId)
);
});
}
// 由计轴侧load
// if (this.datas.axleCountings) {
// this.datas.axleCountings.forEach((acId) => {
// this.relationManage.addRelation(
// this,
// this.queryStore.queryById<AxleCounting>(acId)
// );
// });
// }
}
}

View File

@ -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;