区段常规运行方向生成规则调整

This commit is contained in:
Yuan 2023-12-06 14:42:39 +08:00
parent 6f8ea46425
commit a207716879
2 changed files with 22 additions and 16 deletions

View File

@ -97,11 +97,11 @@ export function createRelatedRefProto(
id,
});
if (port) {
if (port === 'A')
if (port === DevicePort.A)
protoData.devicePort = graphicData.RelatedRef.DevicePort.A;
if (port === 'B')
if (port === DevicePort.B)
protoData.devicePort = graphicData.RelatedRef.DevicePort.B;
if (port === 'C')
if (port === DevicePort.C)
protoData.devicePort = graphicData.RelatedRef.DevicePort.C;
}
return protoData;

View File

@ -20,22 +20,24 @@ import { Turnout } from '../turnout/Turnout';
import { IRelatedRefData, createRelatedRefProto } from '../CommonGraphics';
import { Signal } from '../signal/Signal';
import { loadGenerateAxleCountingConfig } from 'src/drawApp/commonApp';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export interface IAxleCountingDrawOptions {
newData: () => IAxleCountingData;
}
console.log(DevicePort);
enum DevicePort {
A = 0,
B = 1,
C = 2,
}
// enum DevicePort {
// A = 0,
// B = 1,
// C = 2,
// }
enum DevicePortN {
A,
B,
C,
}
// enum DevicePortN {
// A,
// B,
// C,
// }
export class AxleCountingDraw extends GraphicDrawAssistant<
AxleCountingTemplate,
@ -186,7 +188,9 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
});
axleCountingRefs.forEach((axleCountingRef) => {
map.set(
`${axleCountingRef.id}-${DevicePortN[axleCountingRef.devicePort]}`,
`${axleCountingRef.id}-${
graphicData.RelatedRef.DevicePort[axleCountingRef.devicePort]
}`,
1
);
});
@ -282,8 +286,10 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
Turnout.Type
);
turnoutRelations.forEach((relation) => {
const port = relation.getRelationParam(turnout).param;
const portIndex = DevicePort[port] as unknown as number;
const port = relation.getRelationParam(turnout).getParam<DevicePort>();
const portIndex = Object.values(DevicePort).findIndex(
(p) => p === port
);
const refTurnout = relation.getOtherGraphic<Turnout>(turnout);
const refTurnoutPort = relation.getOtherRelationParam(turnout).param;
const portPs = turnout.localToCanvasPoints(...points[portIndex])[