【发车步骤修改】
This commit is contained in:
parent
5495ad8637
commit
b7d02e741a
@ -563,17 +563,7 @@ public class CommandBO {
|
||||
Depart_Train(List.of(), SimulationMember.Type.DRIVER) {
|
||||
@Override
|
||||
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Step execute(Simulation simulation, CommandBO command) {
|
||||
SimulationMember targetMember = command.getTargetMember();
|
||||
VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
||||
if (train == null) {
|
||||
targetMember.setCommand(null);
|
||||
return null;
|
||||
}
|
||||
boolean isRight = train.isRight(); // 列车运行方向
|
||||
Section section = train.getHeadPosition().getSection(); // 列车车头所在区段
|
||||
boolean loop = true;
|
||||
@ -603,14 +593,26 @@ public class CommandBO {
|
||||
// 进路存在且不占用不出故障
|
||||
loop = nextSection != null && !nextSection.isOccupied() && !nextSection.isFaultLock();
|
||||
}
|
||||
targetMember.setCommand(null);
|
||||
List<Step> stepList = new ArrayList<>();
|
||||
if (targetSection != null) {
|
||||
SectionPosition targetPosition = new SectionPosition(targetSection, targetSection.getStopPointByDirection(isRight));
|
||||
// 设置目标位置
|
||||
return buildDriveStep(targetPosition);
|
||||
} else {
|
||||
return null;
|
||||
stepList.add(buildDriveStep(targetPosition));
|
||||
}
|
||||
return stepList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Step execute(Simulation simulation, CommandBO command) {
|
||||
VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
||||
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
|
||||
Step driveStep = steps.get(0);
|
||||
if (train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车已经停到目标位置
|
||||
command.getTargetMember().setCommand(null);
|
||||
} else {
|
||||
return driveStep;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user