ncc图例铁车位置调整

This commit is contained in:
tiger_zhou 2023-05-13 14:04:01 +08:00
parent ed357b2e4a
commit 6c44d38ebd
2 changed files with 11 additions and 17 deletions

View File

@ -81,23 +81,26 @@ public class SortDiagramStation {
}*/
public Station findNext(Station station,boolean isRight){
int index = this.findIndex(station);
if(isRight){
int findIndex = isRight ? index + 1 : index - 1;
return this.findNotDepotStation(isRight,findIndex);
/*if(isRight){
return this.findNotDepotStation(isRight,index + 1);
}else{
return this.findNotDepotStation(isRight,index -1);
}
}*/
}
public Station findPre(Station station,boolean isRight){
int index = this.findIndex(station);
if(isRight){
int findIndex = isRight ? index -1 : index +1;
return this.findNotDepotStation(isRight,findIndex);
/*if(isRight){
return this.findNotDepotStation(isRight,index - 1);
}else{
return this.findNotDepotStation(isRight,index + 1);
}
}*/
}
public Station find(Station station){
int index = this.findIndex(station);

View File

@ -61,8 +61,8 @@ public class RuningService implements CalculateDiagram{
private Float calculateStationRatio(Simulation simulation,Section begin,Section end,VirtualRealityTrain train){
Long mapId = simulation.getBuildParams().getMap().getId();
LocalDateTime simulationDateTime = simulation.getCorrectSystemTime();
Float totalDis;
Float runOffset;
Float totalDis =null;
Float runOffset =null;
try{
totalDis = CalculateService.calculateDistance(begin,end,train.isRight());
if(totalDis == 0F){
@ -71,15 +71,6 @@ public class RuningService implements CalculateDiagram{
}
float off = begin.getStopPointByDirection(train.isRight());
runOffset = CalculateService.calculateDistanceIgnoreSwitchFromStationToTrainHead(new SectionPosition(begin,off),train.getHeadPosition(),train.isRight());
}catch (Exception e){
log.debug("计算失败 线路id:{} 仿真时间:{} 车次[{}] 方向[{}] 车头区段[{}] 车头位置[{}] 车尾区段[{}] 查找开始区段[{}] 结束区段[{}] 错误信息[{}] "
,mapId,simulationDateTime
,train.getGroupNumber(),train.isRight(),train.getHeadPosition().getSection().getCode(),train.getHeadPosition().getOffset()
,train.getTailPosition().getSection().getCode(),begin.getCode(),end.getCode(),e.getMessage(),e);
return null;
}
try{
double t = runOffset / totalDis;
float d = new BigDecimal(t).setScale(3, RoundingMode.HALF_UP).floatValue();
if(d >= 1F){