sectionLink代码调整

This commit is contained in:
fan 2023-07-12 14:03:35 +08:00
parent 76d9ae204b
commit 072b44be90

View File

@ -83,9 +83,8 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
points.push(section.localToCanvasPoint(p));
});
sectionLink.datas.points = points;
const DeviceType = graphicData.SimpleRef.DeviceType;
const refAxle1 = this.buildSimpleRef(axle1.id, DeviceType.AxleCounting);
const refAxle2 = this.buildSimpleRef(axle2.id, DeviceType.AxleCounting);
const refAxle1 = this.buildSimpleRef(axle1.id, srDeviceType.AxleCounting);
const refAxle2 = this.buildSimpleRef(axle2.id, srDeviceType.AxleCounting);
/**
* link AB端 A端一定在左侧AB端是否倒序
*/
@ -123,17 +122,11 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
const points: IPointData[] = [forkP];
const refTurnout = this.buildRelatedRef(
turnout.id,
graphicData.RelatedRef.DeviceType.Turnout,
rrDeviceType.Turnout,
port
);
const refSimTurnout = this.buildSimpleRef(
turnout.id,
graphicData.SimpleRef.DeviceType.Turnout
);
const refAxle = this.buildSimpleRef(
axle.id,
graphicData.SimpleRef.DeviceType.AxleCounting
);
const refSimTurnout = this.buildSimpleRef(turnout.id, srDeviceType.Turnout);
const refAxle = this.buildSimpleRef(axle.id, srDeviceType.AxleCounting);
if (port === rrDevicePort.A) {
turnout.datas.pointA.forEach((p) => {
points.push(turnout.localToCanvasPoint(p));
@ -272,8 +265,6 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
}
/**构建link之间的关联关系 */
buildLinkRef(map: Map<string, string[]>) {
const DeviceType = graphicData.RelatedRef.DeviceType;
const DevicePort = graphicData.RelatedRef.DevicePort;
map.forEach((value) => {
if (value.length === 2) {
const link1 = this.app.queryStore.queryById(value[0]) as SectionLink;
@ -281,46 +272,46 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
if (link1.datas.aSimRef.id === link2.datas.bSimRef.id) {
link1.datas.aRef = this.buildRelatedRef(
link2.id,
DeviceType.SectionLink,
DevicePort.B
rrDeviceType.SectionLink,
rrDevicePort.B
);
link2.datas.bRef = this.buildRelatedRef(
link1.id,
DeviceType.SectionLink,
DevicePort.A
rrDeviceType.SectionLink,
rrDevicePort.A
);
} else if (link1.datas.bSimRef.id === link2.datas.aSimRef.id) {
link1.datas.bRef = this.buildRelatedRef(
link2.id,
DeviceType.SectionLink,
DevicePort.A
rrDeviceType.SectionLink,
rrDevicePort.A
);
link2.datas.aRef = this.buildRelatedRef(
link1.id,
DeviceType.SectionLink,
DevicePort.B
rrDeviceType.SectionLink,
rrDevicePort.B
);
} else if (link1.datas.aSimRef.id === link2.datas.aSimRef.id) {
link1.datas.aRef = this.buildRelatedRef(
link2.id,
DeviceType.SectionLink,
DevicePort.A
rrDeviceType.SectionLink,
rrDevicePort.A
);
link2.datas.aRef = this.buildRelatedRef(
link1.id,
DeviceType.SectionLink,
DevicePort.A
rrDeviceType.SectionLink,
rrDevicePort.A
);
} else if (link1.datas.bSimRef.id === link2.datas.bSimRef.id) {
link1.datas.bRef = this.buildRelatedRef(
link2.id,
DeviceType.SectionLink,
DevicePort.B
rrDeviceType.SectionLink,
rrDevicePort.B
);
link2.datas.bRef = this.buildRelatedRef(
link1.id,
DeviceType.SectionLink,
DevicePort.B
rrDeviceType.SectionLink,
rrDevicePort.B
);
} else {
throw new Error('构建link关联关系错误');