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