@ -5,7 +5,22 @@ import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect ;
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect ;
import club.joylink.rtss.simulation.cbtc.constant.SignalModel ;
import club.joylink.rtss.simulation.cbtc.constant.SignalModel ;
import club.joylink.rtss.simulation.cbtc.data.CalculateService ;
import club.joylink.rtss.simulation.cbtc.data.CalculateService ;
import club.joylink.rtss.simulation.cbtc.data.map.* ;
import club.joylink.rtss.simulation.cbtc.data.map.AutoSignal ;
import club.joylink.rtss.simulation.cbtc.data.map.Cycle ;
import club.joylink.rtss.simulation.cbtc.data.map.DestinationCodeDefinition ;
import club.joylink.rtss.simulation.cbtc.data.map.ESP ;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement ;
import club.joylink.rtss.simulation.cbtc.data.map.PSD ;
import club.joylink.rtss.simulation.cbtc.data.map.Route ;
import club.joylink.rtss.simulation.cbtc.data.map.RouteFls ;
import club.joylink.rtss.simulation.cbtc.data.map.RouteOverlap ;
import club.joylink.rtss.simulation.cbtc.data.map.Section ;
import club.joylink.rtss.simulation.cbtc.data.map.SectionPath ;
import club.joylink.rtss.simulation.cbtc.data.map.Signal ;
import club.joylink.rtss.simulation.cbtc.data.map.Stand ;
import club.joylink.rtss.simulation.cbtc.data.map.Station ;
import club.joylink.rtss.simulation.cbtc.data.map.Switch ;
import club.joylink.rtss.simulation.cbtc.data.map.SwitchElement ;
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath ;
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath ;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException ;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException ;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType ;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType ;
@ -14,7 +29,28 @@ import club.joylink.rtss.vo.map.CiGenerateResultVO;
import club.joylink.rtss.vo.map.MapCiGenerateConfig ;
import club.joylink.rtss.vo.map.MapCiGenerateConfig ;
import club.joylink.rtss.vo.map.MapRoutingSectionNewVO ;
import club.joylink.rtss.vo.map.MapRoutingSectionNewVO ;
import club.joylink.rtss.vo.map.MapVO ;
import club.joylink.rtss.vo.map.MapVO ;
import club.joylink.rtss.vo.map.logic.* ;
import club.joylink.rtss.vo.map.logic.MapAutoReentryVO ;
import club.joylink.rtss.vo.map.logic.MapAutoSignalNewVO ;
import club.joylink.rtss.vo.map.logic.MapDestinationCodeDefinitionVO ;
import club.joylink.rtss.vo.map.logic.MapOverlapVO ;
import club.joylink.rtss.vo.map.logic.MapRouteFlankProtectionNewVO ;
import club.joylink.rtss.vo.map.logic.MapRouteNewVO ;
import club.joylink.rtss.vo.map.logic.MapRoutingDataVO ;
import club.joylink.rtss.vo.map.logic.MapSignalApproachSectionVO ;
import club.joylink.rtss.vo.map.logic.MapStationRunLevelVO ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.Collection ;
import java.util.Collections ;
import java.util.Comparator ;
import java.util.HashMap ;
import java.util.List ;
import java.util.Map ;
import java.util.Objects ;
import java.util.Stack ;
import java.util.concurrent.atomic.AtomicInteger ;
import java.util.function.Function ;
import java.util.stream.Collectors ;
import lombok.Getter ;
import lombok.Getter ;
import lombok.extern.slf4j.Slf4j ;
import lombok.extern.slf4j.Slf4j ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
@ -23,11 +59,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils ;
import org.springframework.util.CollectionUtils ;
import org.springframework.util.StringUtils ;
import org.springframework.util.StringUtils ;
import java.util.* ;
import java.util.concurrent.atomic.AtomicInteger ;
import java.util.function.Function ;
import java.util.stream.Collectors ;
@Slf4j
@Slf4j
@Service
@Service
public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
@ -46,9 +77,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
public CiGenerateResultVO generate ( Long mapId ) {
public CiGenerateResultVO generate ( Long mapId ) {
/ / 先校验地图基础数据
/ / 先校验地图基础数据
MapVO mapVO = this . draftMapService . getDraftMapData ( mapId ) ;
MapVO mapVO = this . draftMapService . getDraftMapData ( mapId ) ;
SimulationBuilder . SimulationDeviceBuildResult buildResult = SimulationBuilder . checkAndBuildBasicMapData ( mapVO ) ;
SimulationBuilder . SimulationDeviceBuildResult buildResult = SimulationBuilder . checkAndBuildBasicMapData (
mapVO ) ;
BusinessExceptionAssertEnum . DATA_ERROR . assertCollectionEmpty ( buildResult . getErrMsgList ( ) ,
BusinessExceptionAssertEnum . DATA_ERROR . assertCollectionEmpty ( buildResult . getErrMsgList ( ) ,
String . format ( " 地图基础数据有错误: %s " , JsonUtils . writeValueAsString ( buildResult . getErrMsgList ( ) ) ) ) ;
String . format ( " 地图基础数据有错误: %s " ,
JsonUtils . writeValueAsString ( buildResult . getErrMsgList ( ) ) ) ) ;
MapCiGenerateConfig generateConfig = mapVO . getGraphDataNew ( ) . getGenerateConfig ( ) ;
MapCiGenerateConfig generateConfig = mapVO . getGraphDataNew ( ) . getGenerateConfig ( ) ;
Map < String , MapElement > deviceMap = buildResult . getDeviceMap ( ) ;
Map < String , MapElement > deviceMap = buildResult . getDeviceMap ( ) ;
/ / 联锁关系数据生成
/ / 联锁关系数据生成
@ -90,7 +123,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
autoReentryVOList . add ( MapAutoReentryVO . fromBO ( cycle ) ) ;
autoReentryVOList . add ( MapAutoReentryVO . fromBO ( cycle ) ) ;
}
}
/ / 目的地码
/ / 目的地码
List < MapDestinationCodeDefinitionVO > destinationCodeDefinitionVOList = result . getDestinationCodeDefinitionList ( ) . stream ( )
List < MapDestinationCodeDefinitionVO > destinationCodeDefinitionVOList = result . getDestinationCodeDefinitionList ( )
. stream ( )
. map ( MapDestinationCodeDefinitionVO : : fromBO ) . collect ( Collectors . toList ( ) ) ;
. map ( MapDestinationCodeDefinitionVO : : fromBO ) . collect ( Collectors . toList ( ) ) ;
/ / 删除旧联锁数据 , 保存新联锁数据
/ / 删除旧联锁数据 , 保存新联锁数据
@ -106,9 +140,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
public int generateDepot ( Long mapId , String stationCode ) {
public int generateDepot ( Long mapId , String stationCode ) {
/ / 先校验地图基础数据
/ / 先校验地图基础数据
MapVO mapVO = this . draftMapService . getDraftMapData ( mapId ) ;
MapVO mapVO = this . draftMapService . getDraftMapData ( mapId ) ;
SimulationBuilder . SimulationDeviceBuildResult buildResult = SimulationBuilder . checkAndBuildBasicMapData ( mapVO ) ;
SimulationBuilder . SimulationDeviceBuildResult buildResult = SimulationBuilder . checkAndBuildBasicMapData (
mapVO ) ;
BusinessExceptionAssertEnum . DATA_ERROR . assertCollectionEmpty ( buildResult . getErrMsgList ( ) ,
BusinessExceptionAssertEnum . DATA_ERROR . assertCollectionEmpty ( buildResult . getErrMsgList ( ) ,
String . format ( " 地图基础数据有错误: %s " , JsonUtils . writeValueAsString ( buildResult . getErrMsgList ( ) ) ) ) ;
String . format ( " 地图基础数据有错误: %s " ,
JsonUtils . writeValueAsString ( buildResult . getErrMsgList ( ) ) ) ) ;
MapCiGenerateConfig generateConfig = mapVO . getGraphDataNew ( ) . getGenerateConfig ( ) ;
MapCiGenerateConfig generateConfig = mapVO . getGraphDataNew ( ) . getGenerateConfig ( ) ;
Map < String , MapElement > deviceMap = buildResult . getDeviceMap ( ) ;
Map < String , MapElement > deviceMap = buildResult . getDeviceMap ( ) ;
/ / 处理旧数据
/ / 处理旧数据
@ -141,13 +177,17 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
/ / 列车兼调车信号机 、 调车信号机
/ / 列车兼调车信号机 、 调车信号机
if ( signal . getType ( ) . equals ( Signal . SignalType . SHUNTING2 ) ) {
if ( signal . getType ( ) . equals ( Signal . SignalType . SHUNTING2 ) ) {
signal . setType ( Signal . SignalType . SHUNTING ) ;
signal . setType ( Signal . SignalType . SHUNTING ) ;
generatedRouteList . addAll ( this . generateRouteDepot ( signal , routeCodeGenerator , generateConfig , errorList ) ) ;
generatedRouteList . addAll (
this . generateRouteDepot ( signal , routeCodeGenerator , generateConfig , errorList ) ) ;
signal . setType ( Signal . SignalType . SHUNTING2 ) ;
signal . setType ( Signal . SignalType . SHUNTING2 ) ;
generatedRouteList . addAll ( this . generateRouteDepot ( signal , routeCodeGenerator , generateConfig , errorList ) ) ;
generatedRouteList . addAll (
this . generateRouteDepot ( signal , routeCodeGenerator , generateConfig , errorList ) ) ;
} else if ( signal . getType ( ) . equals ( Signal . SignalType . SHUNTING ) ) {
} else if ( signal . getType ( ) . equals ( Signal . SignalType . SHUNTING ) ) {
generatedRouteList . addAll ( this . generateRouteDepot ( signal , routeCodeGenerator , generateConfig , errorList ) ) ;
generatedRouteList . addAll (
this . generateRouteDepot ( signal , routeCodeGenerator , generateConfig , errorList ) ) ;
} else if ( signal . getType ( ) . equals ( Signal . SignalType . INBOUND ) ) {
} else if ( signal . getType ( ) . equals ( Signal . SignalType . INBOUND ) ) {
generatedRouteList . addAll ( this . generateRouteDepot ( signal , routeCodeGenerator , generateConfig , errorList ) ) ;
generatedRouteList . addAll (
this . generateRouteDepot ( signal , routeCodeGenerator , generateConfig , errorList ) ) ;
}
}
}
}
log . info ( String . format ( " 生成一般进路[%s]条 " , generatedRouteList . size ( ) ) ) ;
log . info ( String . format ( " 生成一般进路[%s]条 " , generatedRouteList . size ( ) ) ) ;
@ -170,6 +210,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* 唯一编码生成器
* 唯一编码生成器
* /
* /
public static class CodeGenerator {
public static class CodeGenerator {
public static final String Prefix_Route = " Route " ;
public static final String Prefix_Route = " Route " ;
public static final String Prefix_Overlap = " Overlap " ;
public static final String Prefix_Overlap = " Overlap " ;
public static final String Prefix_Fls = " Fls " ;
public static final String Prefix_Fls = " Fls " ;
@ -221,6 +262,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
@Getter
@Getter
private class CiGenerateResult {
private class CiGenerateResult {
private List < String > errMsgList ;
private List < String > errMsgList ;
private List < Signal > approachList ;
private List < Signal > approachList ;
@ -233,8 +275,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List < MapRoutingDataVO > routingList ;
List < MapRoutingDataVO > routingList ;
public CiGenerateResult ( List < String > errMsgList , List < Signal > approachList , List < AutoSignal > autoSignalList , List < Route > routeList ,
public CiGenerateResult ( List < String > errMsgList , List < Signal > approachList ,
List < RouteOverlap > overlapList , List < RouteFls > flsList , List < Cycle > generateCycleList , List < MapRoutingDataVO > routingList ,
List < AutoSignal > autoSignalList , List < Route > routeList ,
List < RouteOverlap > overlapList , List < RouteFls > flsList , List < Cycle > generateCycleList ,
List < MapRoutingDataVO > routingList ,
List < DestinationCodeDefinition > destinationCodeDefinitionList ) {
List < DestinationCodeDefinition > destinationCodeDefinitionList ) {
this . errMsgList = errMsgList ;
this . errMsgList = errMsgList ;
this . approachList = approachList ;
this . approachList = approachList ;
@ -269,7 +313,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
private CiGenerateResult generate ( Long mapId , Map < String , MapElement > deviceMap , MapCiGenerateConfig config ) {
private CiGenerateResult generate ( Long mapId , Map < String , MapElement > deviceMap ,
MapCiGenerateConfig config ) {
List < String > errorList = new ArrayList < > ( ) ;
List < String > errorList = new ArrayList < > ( ) ;
List < AutoSignal > autoSignalList = new ArrayList < > ( ) ;
List < AutoSignal > autoSignalList = new ArrayList < > ( ) ;
List < Route > generatedRouteList = new ArrayList < > ( ) ;
List < Route > generatedRouteList = new ArrayList < > ( ) ;
@ -321,7 +366,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} else if ( signal . isProtectionSignal ( ) ) {
} else if ( signal . isProtectionSignal ( ) ) {
/ / 防护信号机 , 生成进路
/ / 防护信号机 , 生成进路
if ( config . isLikeHa1 ( ) ) {
if ( config . isLikeHa1 ( ) ) {
generatedRouteList . addAll ( this . generateRouteLikeHa1 ( signal , routeCodeGenerator , overlapMap ,
generatedRouteList . addAll (
this . generateRouteLikeHa1 ( signal , routeCodeGenerator , overlapMap ,
overlapCodeGenerator , config , errorList ) ) ;
overlapCodeGenerator , config , errorList ) ) ;
} else {
} else {
generatedRouteList . addAll ( this . generateRoute ( signal ,
generatedRouteList . addAll ( this . generateRoute ( signal ,
@ -376,7 +422,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
/ / 根据配置生成折返进路
/ / 根据配置生成折返进路
if ( config . isGenerateTbRoute ( ) ) {
if ( config . isGenerateTbRoute ( ) ) {
List < Route > tbRouteList = this . generateTurnBackRoute ( generatedRouteList , routeCodeGenerator , config ) ;
List < Route > tbRouteList = this . generateTurnBackRoute ( generatedRouteList , routeCodeGenerator ,
config ) ;
generatedRouteList . addAll ( tbRouteList ) ;
generatedRouteList . addAll ( tbRouteList ) ;
}
}
/ / 清除不需要的基本进路
/ / 清除不需要的基本进路
@ -411,7 +458,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
/ / 生成交路数据
/ / 生成交路数据
List < MapRoutingDataVO > generateRoutingList = this . routingGenerator . generateAllRouting ( deviceMap , errorList ) ;
List < MapRoutingDataVO > generateRoutingList = this . routingGenerator . generateAllRouting ( deviceMap ,
errorList ) ;
/ / 目的地码生成
/ / 目的地码生成
List < DestinationCodeDefinition > destinationCodeDefinitionList
List < DestinationCodeDefinition > destinationCodeDefinitionList
@ -422,7 +470,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
generateCycleList , generateRoutingList , destinationCodeDefinitionList ) ;
generateCycleList , generateRoutingList , destinationCodeDefinitionList ) ;
}
}
private List < DestinationCodeDefinition > generateDestinationCodeDefinition ( MapCiGenerateConfig config , List < Section > sectionList , List < Station > stationList ) {
private List < DestinationCodeDefinition > generateDestinationCodeDefinition (
MapCiGenerateConfig config , List < Section > sectionList , List < Station > stationList ) {
List < DestinationCodeDefinition > destinationCodeDefinitionList = new ArrayList < > ( ) ;
List < DestinationCodeDefinition > destinationCodeDefinitionList = new ArrayList < > ( ) ;
if ( config . isGenerateDestination ( ) ) {
if ( config . isGenerateDestination ( ) ) {
String code = null ;
String code = null ;
@ -442,9 +491,12 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
for ( int i = 0 ; i < stationList . size ( ) ; i + + ) {
for ( int i = 0 ; i < stationList . size ( ) ; i + + ) {
leftStation = stationList . get ( i ) ;
leftStation = stationList . get ( i ) ;
if ( CollectionUtils . isEmpty ( leftStation . getTurnBackList ( ) ) ) / / 没有折返轨的略过
if ( CollectionUtils . isEmpty ( leftStation . getTurnBackList ( ) ) ) / / 没有折返轨的略过
{
continue ;
continue ;
if ( i = = stationList . size ( ) - 1 )
}
if ( i = = stationList . size ( ) - 1 ) {
break ;
break ;
}
List < Section > leftTbSections = queryAfterTurnBackList ( leftStation , false ) ;
List < Section > leftTbSections = queryAfterTurnBackList ( leftStation , false ) ;
leftTbSections . addAll ( queryFrontTurnBackList ( stationList , leftStation , false ) ) ;
leftTbSections . addAll ( queryFrontTurnBackList ( stationList , leftStation , false ) ) ;
@ -464,8 +516,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
leftFrontTurnBack = startTbSection . isNormalStandTrack ( ) ;
leftFrontTurnBack = startTbSection . isNormalStandTrack ( ) ;
rightFrontTurnBack = endTbSection . isNormalStandTrack ( ) ;
rightFrontTurnBack = endTbSection . isNormalStandTrack ( ) ;
destinationCodeDefinitionList . add (
destinationCodeDefinitionList . add (
new DestinationCodeDefinition ( code , type , description , null , null , right , necessarySections ,
new DestinationCodeDefinition ( code , type , description , null , null , right ,
leftStation , leftFrontTurnBack , rightStation , rightFrontTurnBack , null , null , null )
necessarySections ,
leftStation , leftFrontTurnBack , rightStation , rightFrontTurnBack , null , null ,
null )
) ;
) ;
}
}
}
}
@ -478,7 +532,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if ( ! StringUtils . hasText ( destinationCode ) ) {
if ( ! StringUtils . hasText ( destinationCode ) ) {
continue ;
continue ;
}
}
destinationCodeDefinitionList . add ( new DestinationCodeDefinition ( destinationCode , DestinationCodeDefinition . Type . OTHER , section ) ) ;
destinationCodeDefinitionList . add (
new DestinationCodeDefinition ( destinationCode , DestinationCodeDefinition . Type . OTHER ,
section ) ) ;
}
}
}
}
}
}
@ -491,9 +547,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param stations 所有车站
* @param stations 所有车站
* @param right 是否是右端车站
* @param right 是否是右端车站
* /
* /
private List < Section > queryFrontTurnBackList ( List < Station > stations , Station station , boolean right ) {
private List < Section > queryFrontTurnBackList ( List < Station > stations , Station station ,
boolean right ) {
List < Section > turnBackList = station . getTurnBackList ( ) ;
List < Section > turnBackList = station . getTurnBackList ( ) ;
if ( CollectionUtils . isEmpty ( turnBackList ) | | CollectionUtils . isEmpty ( station . getAllNormalStands ( ) ) ) {
if ( CollectionUtils . isEmpty ( turnBackList ) | | CollectionUtils . isEmpty (
station . getAllNormalStands ( ) ) ) {
return new ArrayList < > ( ) ;
return new ArrayList < > ( ) ;
}
}
int sn ;
int sn ;
@ -513,20 +571,28 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List < Section > tbSections = new ArrayList < > ( ) ;
List < Section > tbSections = new ArrayList < > ( ) ;
if ( right ) {
if ( right ) {
if ( rightStandTrack . isTurnBackTrack ( )
if ( rightStandTrack . isTurnBackTrack ( )
& & ! CollectionUtils . isEmpty ( CalculateService . queryRoutePathsOnDirection ( rightStandTrack , adjacentLeftStandTrack , false , 10 ) ) ) {
& & ! CollectionUtils . isEmpty (
CalculateService . queryRoutePathsOnDirection ( rightStandTrack , adjacentLeftStandTrack ,
false , 10 ) ) ) {
tbSections . add ( rightStandTrack ) ;
tbSections . add ( rightStandTrack ) ;
}
}
if ( leftStandTrack . isTurnBackTrack ( )
if ( leftStandTrack . isTurnBackTrack ( )
& & ! CollectionUtils . isEmpty ( CalculateService . queryRoutePathsOnDirection ( adjacentRightStandTrack , leftStandTrack , true , 10 ) ) ) {
& & ! CollectionUtils . isEmpty (
CalculateService . queryRoutePathsOnDirection ( adjacentRightStandTrack , leftStandTrack , true ,
10 ) ) ) {
tbSections . add ( leftStandTrack ) ;
tbSections . add ( leftStandTrack ) ;
}
}
} else {
} else {
if ( rightStandTrack . isTurnBackTrack ( )
if ( rightStandTrack . isTurnBackTrack ( )
& & ! CollectionUtils . isEmpty ( CalculateService . queryRoutePathsOnDirection ( adjacentLeftStandTrack , rightStandTrack , false , 10 ) ) ) {
& & ! CollectionUtils . isEmpty (
CalculateService . queryRoutePathsOnDirection ( adjacentLeftStandTrack , rightStandTrack ,
false , 10 ) ) ) {
tbSections . add ( rightStandTrack ) ;
tbSections . add ( rightStandTrack ) ;
}
}
if ( leftStandTrack . isTurnBackTrack ( )
if ( leftStandTrack . isTurnBackTrack ( )
& & ! CollectionUtils . isEmpty ( CalculateService . queryRoutePathsOnDirection ( leftStandTrack , adjacentRightStandTrack , true , 10 ) ) ) {
& & ! CollectionUtils . isEmpty (
CalculateService . queryRoutePathsOnDirection ( leftStandTrack , adjacentRightStandTrack , true ,
10 ) ) ) {
tbSections . add ( leftStandTrack ) ;
tbSections . add ( leftStandTrack ) ;
}
}
}
}
@ -545,17 +611,20 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
Section standTrack = station . getNormalStand ( right ) . get ( 0 ) . getSection ( ) ;
Section standTrack = station . getNormalStand ( right ) . get ( 0 ) . getSection ( ) ;
return turnBackList . stream ( ) . filter ( section - > ! section . isNormalStandTrack ( ) )
return turnBackList . stream ( ) . filter ( section - > ! section . isNormalStandTrack ( ) )
. filter ( section - > ! CollectionUtils . isEmpty ( CalculateService . queryRoutePathsOnDirection ( standTrack , section , right , 10 ) ) )
. filter ( section - > ! CollectionUtils . isEmpty (
CalculateService . queryRoutePathsOnDirection ( standTrack , section , right , 10 ) ) )
. collect ( Collectors . toList ( ) ) ;
. collect ( Collectors . toList ( ) ) ;
}
}
private Collection < ? extends Route > generateRouteLikeHa1 ( Signal signal , CodeGenerator routeCodeGenerator ,
private Collection < ? extends Route > generateRouteLikeHa1 ( Signal signal ,
CodeGenerator routeCodeGenerator ,
Map < String , List < RouteOverlap > > overlapMap ,
Map < String , List < RouteOverlap > > overlapMap ,
CodeGenerator overlapCodeGenerator ,
CodeGenerator overlapCodeGenerator ,
MapCiGenerateConfig config , List < String > errorList ) {
MapCiGenerateConfig config , List < String > errorList ) {
/ / 生成ATP信号
/ / 生成ATP信号
List < Route > routeList = new ArrayList < > ( ) ;
List < Route > routeList = new ArrayList < > ( ) ;
List < Route > atpRouteList = this . generateRoute ( signal , routeCodeGenerator , overlapMap , overlapCodeGenerator , config , errorList ) ;
List < Route > atpRouteList = this . generateRoute ( signal , routeCodeGenerator , overlapMap ,
overlapCodeGenerator , config , errorList ) ;
if ( ! CollectionUtils . isEmpty ( atpRouteList ) ) {
if ( ! CollectionUtils . isEmpty ( atpRouteList ) ) {
for ( Route route : atpRouteList ) {
for ( Route route : atpRouteList ) {
route . setAtp ( true ) ;
route . setAtp ( true ) ;
@ -567,7 +636,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
}
}
/ / 生成地面信号
/ / 生成地面信号
List < Route > groundRouteList = this . generateGroundRoute ( signal , routeCodeGenerator , overlapMap , overlapCodeGenerator , config , errorList ) ;
List < Route > groundRouteList = this . generateGroundRoute ( signal , routeCodeGenerator , overlapMap ,
overlapCodeGenerator , config , errorList ) ;
if ( ! CollectionUtils . isEmpty ( groundRouteList ) ) {
if ( ! CollectionUtils . isEmpty ( groundRouteList ) ) {
for ( Route ground : groundRouteList ) {
for ( Route ground : groundRouteList ) {
ground . setGround ( true ) ;
ground . setGround ( true ) ;
@ -578,14 +648,16 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
/ / 生成引导信号
/ / 生成引导信号
if ( ! CollectionUtils . isEmpty ( groundRouteList ) ) {
if ( ! CollectionUtils . isEmpty ( groundRouteList ) ) {
for ( Route route : groundRouteList ) {
for ( Route route : groundRouteList ) {
Route guide = this . buildGuideRouteFromGroundRoute ( route , routeCodeGenerator , config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) ) ;
Route guide = this . buildGuideRouteFromGroundRoute ( route , routeCodeGenerator ,
config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) ) ;
routeList . add ( guide ) ;
routeList . add ( guide ) ;
}
}
}
}
return routeList ;
return routeList ;
}
}
private Route buildGuideRouteFromGroundRoute ( Route route , CodeGenerator routeCodeGenerator , boolean noStandHold ) {
private Route buildGuideRouteFromGroundRoute ( Route route , CodeGenerator routeCodeGenerator ,
boolean noStandHold ) {
Route clone = new Route ( routeCodeGenerator . next ( ) , route . getName ( ) ) ;
Route clone = new Route ( routeCodeGenerator . next ( ) , route . getName ( ) ) ;
clone . setArs ( false ) ;
clone . setArs ( false ) ;
clone . setGuide ( true ) ;
clone . setGuide ( true ) ;
@ -616,7 +688,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List < SectionPath > routePathList = new ArrayList < > ( ) ;
List < SectionPath > routePathList = new ArrayList < > ( ) ;
getRoutePathOf ( signal , startSection , true ,
getRoutePathOf ( signal , startSection , true ,
new SectionPath ( right ) , routePathList , config , errorList ) ;
new SectionPath ( right ) , routePathList , config , errorList ) ;
List < Route > routeList = this . buildRouteFromPath ( signal , routeCodeGenerator , routePathList , overlapMap ,
List < Route > routeList = this . buildRouteFromPath ( signal , routeCodeGenerator , routePathList ,
overlapMap ,
overlapCodeGenerator , config , errorList ) ;
overlapCodeGenerator , config , errorList ) ;
return routeList ;
return routeList ;
}
}
@ -645,7 +718,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
return routeList ;
return routeList ;
}
}
private List < Route > buildRouteFromPath ( Signal start , CodeGenerator routeCodeGenerator , List < SectionPath > routePathList ,
private List < Route > buildRouteFromPath ( Signal start , CodeGenerator routeCodeGenerator ,
List < SectionPath > routePathList ,
Map < String , List < RouteOverlap > > overlapMap ,
Map < String , List < RouteOverlap > > overlapMap ,
CodeGenerator overlapCodeGenerator ,
CodeGenerator overlapCodeGenerator ,
MapCiGenerateConfig config , List < String > errorList ) {
MapCiGenerateConfig config , List < String > errorList ) {
@ -690,8 +764,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
for ( RouteOverlap routeOverlap : overlapList ) {
for ( RouteOverlap routeOverlap : overlapList ) {
String code = routeCodeGenerator . next ( ) ;
String code = routeCodeGenerator . next ( ) ;
String name = String . format ( " %s-%s_%s " , start . getName ( ) , endName , index ) ;
String name = String . format ( " %s-%s_%s " , start . getName ( ) , endName , index ) ;
Route route = this . buildRoute ( code , name , start , end , clickEnd , sectionPath , routeOverlap ,
Route route = this . buildRoute ( code , name , start , end , clickEnd , sectionPath ,
config . isRouteSignalAlwaysGreen ( ) , config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) , singleTrain ) ;
routeOverlap ,
config . isRouteSignalAlwaysGreen ( ) ,
config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) , singleTrain ) ;
routeList . add ( route ) ;
routeList . add ( route ) ;
+ + index ;
+ + index ;
}
}
@ -699,7 +775,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
String code = routeCodeGenerator . next ( ) ;
String code = routeCodeGenerator . next ( ) ;
String name = String . format ( " %s-%s " , start . getName ( ) , endName ) ;
String name = String . format ( " %s-%s " , start . getName ( ) , endName ) ;
Route route = this . buildRoute ( code , name , start , end , clickEnd , sectionPath , null ,
Route route = this . buildRoute ( code , name , start , end , clickEnd , sectionPath , null ,
config . isRouteSignalAlwaysGreen ( ) , config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) , singleTrain ) ;
config . isRouteSignalAlwaysGreen ( ) ,
config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) , singleTrain ) ;
routeList . add ( route ) ;
routeList . add ( route ) ;
} else {
} else {
String code = routeCodeGenerator . next ( ) ;
String code = routeCodeGenerator . next ( ) ;
@ -709,12 +786,14 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
overlap = overlapList . get ( 0 ) ;
overlap = overlapList . get ( 0 ) ;
}
}
Route route = this . buildRoute ( code , name , start , end , clickEnd , sectionPath , overlap ,
Route route = this . buildRoute ( code , name , start , end , clickEnd , sectionPath , overlap ,
config . isRouteSignalAlwaysGreen ( ) , config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) , singleTrain ) ;
config . isRouteSignalAlwaysGreen ( ) ,
config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) , singleTrain ) ;
routeList . add ( route ) ;
routeList . add ( route ) ;
}
}
}
}
} else {
} else {
errorList . add ( String . format ( " 以[%s(%s)]为始端信号的进路未搜索到 " , start . getName ( ) , start . getCode ( ) ) ) ;
errorList . add (
String . format ( " 以[%s(%s)]为始端信号的进路未搜索到 " , start . getName ( ) , start . getCode ( ) ) ) ;
}
}
return routeList ;
return routeList ;
}
}
@ -724,11 +803,13 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
boolean right = start . isRight ( ) ;
boolean right = start . isRight ( ) ;
Section startSection = start . getSection ( ) . getSectionOf ( right ) ;
Section startSection = start . getSection ( ) . getSectionOf ( right ) ;
List < SectionPath > routePathList = new ArrayList < > ( ) ;
List < SectionPath > routePathList = new ArrayList < > ( ) ;
getRoutePathOfDepot ( start , startSection , new SectionPath ( right ) , routePathList , config , errorList ) ;
getRoutePathOfDepot ( start , startSection , new SectionPath ( right ) , routePathList , config ,
errorList ) ;
return buildRouteFromPathDepot ( start , routeCodeGenerator , routePathList , config , errorList ) ;
return buildRouteFromPathDepot ( start , routeCodeGenerator , routePathList , config , errorList ) ;
}
}
private List < Route > buildRouteFromPathDepot ( Signal startSignal , CodeGenerator routeCodeGenerator , List < SectionPath > routePathList ,
private List < Route > buildRouteFromPathDepot ( Signal startSignal , CodeGenerator routeCodeGenerator ,
List < SectionPath > routePathList ,
MapCiGenerateConfig config , List < String > errorList ) {
MapCiGenerateConfig config , List < String > errorList ) {
boolean right = startSignal . isRight ( ) ;
boolean right = startSignal . isRight ( ) ;
List < Route > routeList = new ArrayList < > ( ) ;
List < Route > routeList = new ArrayList < > ( ) ;
@ -741,16 +822,20 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
Signal . SignalType endSignalType = Objects . nonNull ( endSignal ) ? endSignal . getType ( ) : null ;
Signal . SignalType endSignalType = Objects . nonNull ( endSignal ) ? endSignal . getType ( ) : null ;
/ / 反向信号机
/ / 反向信号机
Signal endOpSignal = lastSection . getSignalOf ( ! right ) ;
Signal endOpSignal = lastSection . getSignalOf ( ! right ) ;
Signal . SignalType endOpSignalType = Objects . nonNull ( endOpSignal ) ? endOpSignal . getType ( ) : null ;
Signal . SignalType endOpSignalType =
Objects . nonNull ( endOpSignal ) ? endOpSignal . getType ( ) : null ;
Section nextSection = lastSection . getSectionOf ( right ) ;
Section nextSection = lastSection . getSectionOf ( right ) ;
/ / 下个区段反向信号机
/ / 下个区段反向信号机
Signal nextOpSignal = Objects . nonNull ( nextSection ) ? nextSection . getSignalOf ( ! right ) : null ;
Signal nextOpSignal = Objects . nonNull ( nextSection ) ? nextSection . getSignalOf ( ! right ) : null ;
Signal clickEnd ;
Signal clickEnd ;
SignalAspect signalAspect ;
SignalAspect signalAspect ;
if ( ( Signal . SignalType . SHUNTING2 . equals ( endSignalType ) & & Signal . SignalType . SHUNTING2 . equals ( startSignalType ) )
if ( ( Signal . SignalType . SHUNTING2 . equals ( endSignalType )
| | ( Signal . SignalType . SHUNTING2 . equals ( endSignalType ) & & Signal . SignalType . INBOUND . equals ( startSignalType ) )
& & Signal . SignalType . SHUNTING2 . equals ( startSignalType ) )
| | ( Signal . SignalType . OUTBOUND . equals ( endSignalType ) & & Signal . SignalType . SHUNTING2 . equals ( startSignalType ) ) ) {
| | ( Signal . SignalType . SHUNTING2 . equals ( endSignalType )
& & Signal . SignalType . INBOUND . equals ( startSignalType ) )
| | ( Signal . SignalType . OUTBOUND . equals ( endSignalType )
& & Signal . SignalType . SHUNTING2 . equals ( startSignalType ) ) ) {
/ / 列车进路
/ / 列车进路
signalAspect = SignalAspect . Y ;
signalAspect = SignalAspect . Y ;
if ( Objects . nonNull ( endOpSignal ) & & ( Signal . SignalType . SHUNTING2 . equals ( endOpSignalType )
if ( Objects . nonNull ( endOpSignal ) & & ( Signal . SignalType . SHUNTING2 . equals ( endOpSignalType )
@ -774,15 +859,18 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
}
}
String endName = Objects . nonNull ( endSignal ) ? endSignal . getShowName ( ) : lastSection . getName ( ) ;
String endName =
Objects . nonNull ( endSignal ) ? endSignal . getShowName ( ) : lastSection . getName ( ) ;
/ / 构建进路
/ / 构建进路
String code = routeCodeGenerator . next ( ) ;
String code = routeCodeGenerator . next ( ) ;
String name = String . format ( " %s-%s " , startSignal . getShowName ( ) , endName ) ;
String name = String . format ( " %s-%s " , startSignal . getShowName ( ) , endName ) ;
Route route = this . buildRouteDepot ( code , name , startSignal , endSignal , clickEnd , sectionPath , signalAspect ) ;
Route route = this . buildRouteDepot ( code , name , startSignal , endSignal , clickEnd ,
sectionPath , signalAspect ) ;
routeList . add ( route ) ;
routeList . add ( route ) ;
}
}
} else {
} else {
errorList . add ( String . format ( " 以[%s(%s)]为始端信号(%s)的进路未搜索到 " , startSignal . getShowName ( ) ,
errorList . add (
String . format ( " 以[%s(%s)]为始端信号(%s)的进路未搜索到 " , startSignal . getShowName ( ) ,
startSignal . getCode ( ) , startSignal . getType ( ) ) ) ;
startSignal . getCode ( ) , startSignal . getType ( ) ) ) ;
}
}
return routeList ;
return routeList ;
@ -824,7 +912,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param generatedRouteList
* @param generatedRouteList
* /
* /
private void deleteBaseRoute ( List < Signal > signalList , List < Route > generatedRouteList ) {
private void deleteBaseRoute ( List < Signal > signalList , List < Route > generatedRouteList ) {
Map < String , Signal > signalMap = signalList . stream ( ) . collect ( Collectors . toMap ( Signal : : getCode , Function . identity ( ) ) ) ;
Map < String , Signal > signalMap = signalList . stream ( )
. collect ( Collectors . toMap ( Signal : : getCode , Function . identity ( ) ) ) ;
List < Route > removeList = new ArrayList < > ( ) ;
List < Route > removeList = new ArrayList < > ( ) ;
for ( Route route : generatedRouteList ) {
for ( Route route : generatedRouteList ) {
if ( route . isTurnBack ( ) ) { / / 折返进路不处理
if ( route . isTurnBack ( ) ) { / / 折返进路不处理
@ -874,7 +963,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
Switch linkedSwitch = aSwitch . queryLinkedSwitch ( ) ;
Switch linkedSwitch = aSwitch . queryLinkedSwitch ( ) ;
if ( Objects . nonNull ( linkedSwitch ) ) {
if ( Objects . nonNull ( linkedSwitch ) ) {
/ / 联动道岔存在 , 联动道岔定位即为一级侧防
/ / 联动道岔存在 , 联动道岔定位即为一级侧防
RouteFls . FlsElement flsElement = new RouteFls . FlsElement ( new SwitchElement ( linkedSwitch , true ) ) ;
RouteFls . FlsElement flsElement = new RouteFls . FlsElement (
new SwitchElement ( linkedSwitch , true ) ) ;
fls . addLevel1 ( flsElement ) ;
fls . addLevel1 ( flsElement ) ;
} else {
} else {
/ / 无联动道岔 , 则从道岔C区段向外查询 , 第一个反向信号机和经过的路径道岔位置构成一级侧防
/ / 无联动道岔 , 则从道岔C区段向外查询 , 第一个反向信号机和经过的路径道岔位置构成一级侧防
@ -883,8 +973,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
/ / 尽头区段 , 不需构成侧防
/ / 尽头区段 , 不需构成侧防
return null ;
return null ;
}
}
BusinessExceptionAssertEnum . DATA_ERROR . assertNotTrue ( c . getLeftSection ( ) ! = null & & c . getRightSection ( ) ! = null ,
BusinessExceptionAssertEnum . DATA_ERROR . assertNotTrue (
String . format ( " 道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段 " , c . debugStr ( ) ) ) ;
c . getLeftSection ( ) ! = null & & c . getRightSection ( ) ! = null ,
String . format ( " 道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段 " ,
c . debugStr ( ) ) ) ;
boolean right = true ;
boolean right = true ;
Section startSection = c . getRightSection ( ) ;
Section startSection = c . getRightSection ( ) ;
if ( c . getLeftSection ( ) ! = null ) { / / 左向区段存在 , 方向向左
if ( c . getLeftSection ( ) ! = null ) { / / 左向区段存在 , 方向向左
@ -910,7 +1002,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
relSwitch . isC ( firstSection ) & & relSwitch . isA ( pre ) ) ) {
relSwitch . isC ( firstSection ) & & relSwitch . isA ( pre ) ) ) {
normal = false ;
normal = false ;
}
}
flsElement = new RouteFls . FlsElement ( oppositeSignal , new SwitchElement ( relSwitch , normal ) ) ;
flsElement = new RouteFls . FlsElement ( oppositeSignal ,
new SwitchElement ( relSwitch , normal ) ) ;
} else {
} else {
flsElement = new RouteFls . FlsElement ( oppositeSignal ) ;
flsElement = new RouteFls . FlsElement ( oppositeSignal ) ;
}
}
@ -921,7 +1014,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if ( next ! = null ) {
if ( next ! = null ) {
if ( next . isSwitchTrack ( ) & & next . getRelSwitch ( ) . isC ( next ) ) {
if ( next . isSwitchTrack ( ) & & next . getRelSwitch ( ) . isC ( next ) ) {
/ / C区段 , 一级侧防为此道岔定位
/ / C区段 , 一级侧防为此道岔定位
RouteFls . FlsElement flsElement = new RouteFls . FlsElement ( new SwitchElement ( next . getRelSwitch ( ) , true ) ) ;
RouteFls . FlsElement flsElement = new RouteFls . FlsElement (
new SwitchElement ( next . getRelSwitch ( ) , true ) ) ;
fls . addLevel1 ( flsElement ) ;
fls . addLevel1 ( flsElement ) ;
pre = null ;
pre = null ;
} else {
} else {
@ -966,8 +1060,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
/ / 尽头区段 , 不需构成侧防
/ / 尽头区段 , 不需构成侧防
return null ;
return null ;
}
}
BusinessExceptionAssertEnum . DATA_ERROR . assertNotTrue ( b . getLeftSection ( ) ! = null & & b . getRightSection ( ) ! = null ,
BusinessExceptionAssertEnum . DATA_ERROR . assertNotTrue (
String . format ( " 道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段 " , b . debugStr ( ) ) ) ;
b . getLeftSection ( ) ! = null & & b . getRightSection ( ) ! = null ,
String . format ( " 道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段 " ,
b . debugStr ( ) ) ) ;
boolean right = true ;
boolean right = true ;
Section startSection = b . getRightSection ( ) ;
Section startSection = b . getRightSection ( ) ;
if ( b . getLeftSection ( ) ! = null ) { / / 左向区段存在 , 方向向左
if ( b . getLeftSection ( ) ! = null ) { / / 左向区段存在 , 方向向左
@ -990,9 +1086,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
! Objects . equals ( aSwitch . queryAxleRelatedOtherSwitch ( ) , relSwitch ) ) {
! Objects . equals ( aSwitch . queryAxleRelatedOtherSwitch ( ) , relSwitch ) ) {
Switch remoteSwitch = relSwitch . queryAxleRelatedOtherSwitch ( ) ;
Switch remoteSwitch = relSwitch . queryAxleRelatedOtherSwitch ( ) ;
if ( Objects . nonNull ( remoteSwitch ) ) {
if ( Objects . nonNull ( remoteSwitch ) ) {
flsElement = new RouteFls . FlsElement ( oppositeSignal , new SwitchElement ( remoteSwitch , true ) ) ;
flsElement = new RouteFls . FlsElement ( oppositeSignal ,
new SwitchElement ( remoteSwitch , true ) ) ;
} else {
} else {
flsElement = new RouteFls . FlsElement ( oppositeSignal , new SwitchElement ( relSwitch , true ) ) ;
flsElement = new RouteFls . FlsElement ( oppositeSignal ,
new SwitchElement ( relSwitch , true ) ) ;
}
}
} else {
} else {
flsElement = new RouteFls . FlsElement ( oppositeSignal ) ;
flsElement = new RouteFls . FlsElement ( oppositeSignal ) ;
@ -1003,7 +1101,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if ( next ! = null ) {
if ( next ! = null ) {
if ( next . isSwitchTrack ( ) & & next . getRelSwitch ( ) . isC ( next ) ) {
if ( next . isSwitchTrack ( ) & & next . getRelSwitch ( ) . isC ( next ) ) {
/ / C区段 , 一级侧防为此道岔定位
/ / C区段 , 一级侧防为此道岔定位
RouteFls . FlsElement flsElement = new RouteFls . FlsElement ( new SwitchElement ( next . getRelSwitch ( ) , true ) ) ;
RouteFls . FlsElement flsElement = new RouteFls . FlsElement (
new SwitchElement ( next . getRelSwitch ( ) , true ) ) ;
fls . addLevel1 ( flsElement ) ;
fls . addLevel1 ( flsElement ) ;
} else {
} else {
sectionStack . push ( next ) ;
sectionStack . push ( next ) ;
@ -1063,13 +1162,18 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if ( station . getSn ( ) > min & & station . getSn ( ) < max ) {
if ( station . getSn ( ) > min & & station . getSn ( ) < max ) {
BusinessExceptionAssertEnum . CI_GENERATE_ERROR
BusinessExceptionAssertEnum . CI_GENERATE_ERROR
. assertTrue ( station . isDepot ( ) | | station . isNoDepotAndNoNormalStand ( ) ,
. assertTrue ( station . isDepot ( ) | | station . isNoDepotAndNoNormalStand ( ) ,
String . format ( " 交路[%s]下的站间运行等级[%s]数据间隔车站大于1且间隔中的车站[%s]是正常可停靠车站 " ,
String . format (
" 交路[%s]下的站间运行等级[%s]数据间隔车站大于1且间隔中的车站[%s]是正常可停靠车站 " ,
String . format ( " %s(%s)->%s(%s) " ,
String . format ( " %s(%s)->%s(%s) " ,
routingStartSection . getStation ( ) . getName ( ) , routingStartSection . getName ( ) ,
routingStartSection . getStation ( ) . getName ( ) ,
routingEndSection . getStation ( ) . getName ( ) , routingEndSection . getName ( ) ) ,
routingStartSection . getName ( ) ,
routingEndSection . getStation ( ) . getName ( ) ,
routingEndSection . getName ( ) ) ,
String . format ( " %s(%s(%s))->%s(%s(%s)) " ,
String . format ( " %s(%s(%s))->%s(%s(%s)) " ,
startSection . getStation ( ) . getName ( ) , startSection . getName ( ) , startSection . getCode ( ) ,
startSection . getStation ( ) . getName ( ) , startSection . getName ( ) ,
endSection . getStation ( ) . getName ( ) , endSection . getName ( ) , endSection . getCode ( ) ) ,
startSection . getCode ( ) ,
endSection . getStation ( ) . getName ( ) , endSection . getName ( ) ,
endSection . getCode ( ) ) ,
station . getName ( ) ) ) ;
station . getName ( ) ) ) ;
}
}
}
}
@ -1081,14 +1185,17 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
runLevelVO . setEndSectionCode ( endSection . getCode ( ) ) ;
runLevelVO . setEndSectionCode ( endSection . getCode ( ) ) ;
runLevelVO . setEndStationCode ( endSection . getStation ( ) . getCode ( ) ) ;
runLevelVO . setEndStationCode ( endSection . getStation ( ) . getCode ( ) ) ;
runLevelVO . setRight ( right ) ;
runLevelVO . setRight ( right ) ;
List < RoutePath > routePaths = CalculateService . queryRoutePathsOnDirection ( startSection , endSection , right , 10 ) ;
List < RoutePath > routePaths = CalculateService . queryRoutePathsOnDirection ( startSection ,
endSection , right , 10 ) ;
if ( CollectionUtils . isEmpty ( routePaths ) ) {
if ( CollectionUtils . isEmpty ( routePaths ) ) {
/ / 未找到 , 反方向再找
/ / 未找到 , 反方向再找
routePaths = CalculateService . queryRoutePathsOnDirection ( startSection , endSection , ! right , 10 ) ;
routePaths = CalculateService . queryRoutePathsOnDirection ( startSection , endSection , ! right ,
10 ) ;
if ( ! CollectionUtils . isEmpty ( routePaths ) ) {
if ( ! CollectionUtils . isEmpty ( routePaths ) ) {
log . info ( String . format ( " 站间运行等级[%s]与交路[%s]方向相反,实际为[%s] " ,
log . info ( String . format ( " 站间运行等级[%s]与交路[%s]方向相反,实际为[%s] " ,
String . format ( " %s(%s(%s))->%s(%s(%s)) " ,
String . format ( " %s(%s(%s))->%s(%s(%s)) " ,
startSection . getStation ( ) . getName ( ) , startSection . getName ( ) , startSection . getCode ( ) ,
startSection . getStation ( ) . getName ( ) , startSection . getName ( ) ,
startSection . getCode ( ) ,
endSection . getStation ( ) . getName ( ) , endSection . getName ( ) , endSection . getCode ( ) ) ,
endSection . getStation ( ) . getName ( ) , endSection . getName ( ) , endSection . getCode ( ) ) ,
String . format ( " %s(%s)->%s(%s) " ,
String . format ( " %s(%s)->%s(%s) " ,
routingStartSection . getStation ( ) . getName ( ) , routingStartSection . getName ( ) ,
routingStartSection . getStation ( ) . getName ( ) , routingStartSection . getName ( ) ,
@ -1098,8 +1205,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
}
}
if ( CollectionUtils . isEmpty ( routePaths ) ) {
if ( CollectionUtils . isEmpty ( routePaths ) ) {
log . warn ( String . format ( " 站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间 " ,
log . warn ( String . format (
startSection . getStation ( ) . getName ( ) , startSection . getName ( ) , endSection . getStation ( ) . getName ( ) , endSection . getName ( ) , right ? " 右向 " : " 左向 " ) ) ;
" 站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间 " ,
startSection . getStation ( ) . getName ( ) , startSection . getName ( ) ,
endSection . getStation ( ) . getName ( ) , endSection . getName ( ) , right ? " 右向 " : " 左向 " ) ) ;
/ / errorList . add ( String . format ( " 站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间 " ,
/ / errorList . add ( String . format ( " 站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间 " ,
/ / startSection . getStation ( ) . getName ( ) , startSection . getName ( ) , endSection . getStation ( ) . getName ( ) , endSection . getName ( ) , right ? " 右向 " : " 左向 " ) ) ;
/ / startSection . getStation ( ) . getName ( ) , startSection . getName ( ) , endSection . getStation ( ) . getName ( ) , endSection . getName ( ) , right ? " 右向 " : " 左向 " ) ) ;
continue ;
continue ;
@ -1117,7 +1226,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
}
}
private void buildAutoSignalRouteConflict ( List < AutoSignal > autoSignalList , List < Route > generatedRouteList ) {
private void buildAutoSignalRouteConflict ( List < AutoSignal > autoSignalList ,
List < Route > generatedRouteList ) {
if ( CollectionUtils . isEmpty ( autoSignalList ) ) {
if ( CollectionUtils . isEmpty ( autoSignalList ) ) {
/ / 自动信号为空 , 返回
/ / 自动信号为空 , 返回
return ;
return ;
@ -1195,7 +1305,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
}
}
if ( Objects . isNull ( basicRoute ) ) {
if ( Objects . isNull ( basicRoute ) ) {
errorList . add ( String . format ( " 自动折返数据生成失败:折返进路[%s(%s)]的反向基本进路不存在 " ,
errorList . add (
String . format ( " 自动折返数据生成失败:折返进路[%s(%s)]的反向基本进路不存在 " ,
tbRoute . getName ( ) , tbRoute . getCode ( ) ) ) ;
tbRoute . getName ( ) , tbRoute . getCode ( ) ) ) ;
continue ;
continue ;
}
}
@ -1310,8 +1421,12 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
String code = routeCodeGenerator . next ( ) ;
String code = routeCodeGenerator . next ( ) ;
Route tbRoute = new Route ( code , name ) ;
Route tbRoute = new Route ( code , name ) ;
/ / 拷贝进路其他属性
/ / 拷贝进路其他属性
this . copyToTurnBackRoute ( route , tbRoute , config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) ) ;
this . copyToTurnBackRoute ( route , tbRoute ,
config . isRouteInterlockDoNotIncludeStandHoldTrain ( ) ) ;
tbRoute . setTurnBack ( true ) ;
tbRoute . setTurnBack ( true ) ;
if ( config . isTbRouteNameUseEndOppositeSignalName ( ) ) {
tbRoute . setDestinationButtonSignal ( endOppositeSignal ) ;
}
/ / 如果生成进路按钮 , 折返进路按钮默认为终端信号机
/ / 如果生成进路按钮 , 折返进路按钮默认为终端信号机
if ( config . isRouteButton ( ) ) {
if ( config . isRouteButton ( ) ) {
tbRoute . setDestinationButtonSignal ( route . getDestination ( ) ) ;
tbRoute . setDestinationButtonSignal ( route . getDestination ( ) ) ;
@ -1424,7 +1539,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* /
* /
private Route buildRoute ( String code , String name ,
private Route buildRoute ( String code , String name ,
Signal start , Signal end , Signal endButton ,
Signal start , Signal end , Signal endButton ,
SectionPath sectionPath , RouteOverlap routeOverlap , boolean alwaysGreen , boolean noStandHold , boolean singleTrain ) {
SectionPath sectionPath , RouteOverlap routeOverlap , boolean alwaysGreen , boolean noStandHold ,
boolean singleTrain ) {
Route route = new Route ( code , name ) ;
Route route = new Route ( code , name ) ;
route . setInterlockStation ( start . getInterlockStation ( ) ) ;
route . setInterlockStation ( start . getInterlockStation ( ) ) ;
route . setStart ( start ) ;
route . setStart ( start ) ;
@ -1436,7 +1552,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
route . setSingleTrain ( singleTrain ) ;
route . setSingleTrain ( singleTrain ) ;
SignalModel signalModel = start . getSignalModel ( ) ;
SignalModel signalModel = start . getSignalModel ( ) ;
switch ( signalModel ) {
switch ( signalModel ) {
case RGY : {
case RGY : {
route . setAspect ( SignalAspect . G ) ;
route . setAspect ( SignalAspect . G ) ;
if ( ! alwaysGreen & & sectionPath . containRpSwitch ( ) ) {
if ( ! alwaysGreen & & sectionPath . containRpSwitch ( ) ) {
route . setAspect ( SignalAspect . Y ) ;
route . setAspect ( SignalAspect . Y ) ;
@ -1447,7 +1563,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
route . setAspect ( SignalAspect . W ) ;
route . setAspect ( SignalAspect . W ) ;
break ;
break ;
default :
default :
throw BusinessExceptionAssertEnum . DATA_ERROR . exception ( String . format ( " 信号机[%s]型号[%s]不正确 " ,
throw BusinessExceptionAssertEnum . DATA_ERROR . exception (
String . format ( " 信号机[%s]型号[%s]不正确 " ,
start . debugStr ( ) , start . getSignalModel ( ) ) ) ;
start . debugStr ( ) , start . getSignalModel ( ) ) ) ;
}
}
route . setTurnBack ( false ) ;
route . setTurnBack ( false ) ;
@ -1641,7 +1758,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List < SectionPath > triggerPathList = new ArrayList < > ( ) ;
List < SectionPath > triggerPathList = new ArrayList < > ( ) ;
Section section = signalSection ;
Section section = signalSection ;
/ / 反方向找触发区段
/ / 反方向找触发区段
this . getOverlapTriggerPathOf ( end , section , ! right , new SectionPath ( ! right ) , triggerPathList ) ;
this . getOverlapTriggerPathOf ( end , section , ! right , new SectionPath ( ! right ) ,
triggerPathList ) ;
routeOverlap . setTriggerPathList ( triggerPathList ) ;
routeOverlap . setTriggerPathList ( triggerPathList ) ;
}
}
overlapList . add ( routeOverlap ) ;
overlapList . add ( routeOverlap ) ;
@ -1714,7 +1832,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
getOverlapTriggerPathOf ( end , relSwitch . getA ( ) . getSectionOf ( right ) , right ,
getOverlapTriggerPathOf ( end , relSwitch . getA ( ) . getSectionOf ( right ) , right ,
tempPath , triggerPathList ) ;
tempPath , triggerPathList ) ;
} else {
} else {
log . error ( String . format ( " 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
log . error ( String . format (
" 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
section . getName ( ) , section . getCode ( ) ,
section . getName ( ) , section . getCode ( ) ,
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
return ;
return ;
@ -1753,7 +1872,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
} else if ( Objects . isNull ( section ) ) { / / 如果区段不存在 , 就没有延续保护区段
} else if ( Objects . isNull ( section ) ) { / / 如果区段不存在 , 就没有延续保护区段
return ;
return ;
} else if ( config . isOverlapOnlySwitch ( ) & & ! section . isSwitchTrack ( ) ) { / / 如果只构建道岔延续保护 , 不是道岔区段 , 不构建 , 返回
} else if ( config . isOverlapOnlySwitch ( )
& & ! section . isSwitchTrack ( ) ) { / / 如果只构建道岔延续保护 , 不是道岔区段 , 不构建 , 返回
return ;
return ;
}
}
tempPath . addSection ( section ) ;
tempPath . addSection ( section ) ;
@ -1785,7 +1905,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
/ / if ( config . isCoupleSwitch ( ) ) {
/ / if ( config . isCoupleSwitch ( ) ) {
/ / 如果是同一道岔计轴 , 添加另一道岔定位
/ / 如果是同一道岔计轴 , 添加另一道岔定位
Switch otherSwitch = relSwitch . queryAxleRelatedOtherSwitch ( ) ;
Switch otherSwitch = relSwitch . queryAxleRelatedOtherSwitch ( ) ;
if ( ! config . isGenerateFls ( ) & & Objects . nonNull ( otherSwitch ) & & relSwitch . isBConnectTo ( otherSwitch ) ) {
if ( ! config . isGenerateFls ( ) & & Objects . nonNull ( otherSwitch ) & & relSwitch . isBConnectTo (
otherSwitch ) ) {
rpPath . addSwitchElement ( new SwitchElement ( otherSwitch , true ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( otherSwitch , true ) ) ;
}
}
/ / }
/ / }
@ -1815,13 +1936,15 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
getOverlapPathOf ( relSwitch . getA ( ) . getSectionOf ( right ) , right ,
getOverlapPathOf ( relSwitch . getA ( ) . getSectionOf ( right ) , right ,
tempPath , overlapPathList , config , errorList ) ;
tempPath , overlapPathList , config , errorList ) ;
} else {
} else {
errorList . add ( String . format ( " 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
errorList . add ( String . format (
" 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
section . getName ( ) , section . getCode ( ) ,
section . getName ( ) , section . getCode ( ) ,
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
return ;
return ;
}
}
} else {
} else {
getOverlapPathOf ( section . getSectionOf ( right ) , right , tempPath , overlapPathList , config , errorList ) ;
getOverlapPathOf ( section . getSectionOf ( right ) , right , tempPath , overlapPathList , config ,
errorList ) ;
}
}
}
}
@ -1883,7 +2006,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if ( ! config . isGenerateFls ( ) & & Objects . nonNull ( linkedSwitch ) ) {
if ( ! config . isGenerateFls ( ) & & Objects . nonNull ( linkedSwitch ) ) {
npPath . addSwitchElement ( new SwitchElement ( linkedSwitch , true ) ) ;
npPath . addSwitchElement ( new SwitchElement ( linkedSwitch , true ) ) ;
}
}
getRoutePathOf ( startSignal , relSwitch . getB ( ) . getSectionOf ( right ) , ground , npPath , routePathList , config , errorList ) ;
getRoutePathOf ( startSignal , relSwitch . getB ( ) . getSectionOf ( right ) , ground , npPath ,
routePathList , config , errorList ) ;
SectionPath rpPath = tempPath . cloneNew ( ) ; / / 反位路径
SectionPath rpPath = tempPath . cloneNew ( ) ; / / 反位路径
rpPath . addSection ( relSwitch . getC ( ) ) ;
rpPath . addSection ( relSwitch . getC ( ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( relSwitch , false ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( relSwitch , false ) ) ;
@ -1892,7 +2016,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
/ / }
/ / }
/ / 如果是同一道岔计轴 , 添加另一道岔定位
/ / 如果是同一道岔计轴 , 添加另一道岔定位
Switch otherSwitch = relSwitch . queryAxleRelatedOtherSwitch ( ) ;
Switch otherSwitch = relSwitch . queryAxleRelatedOtherSwitch ( ) ;
if ( ! config . isGenerateFls ( ) & & Objects . nonNull ( otherSwitch ) & & relSwitch . isBConnectTo ( otherSwitch ) ) {
if ( ! config . isGenerateFls ( ) & & Objects . nonNull ( otherSwitch ) & & relSwitch . isBConnectTo (
otherSwitch ) ) {
rpPath . addSwitchElement ( new SwitchElement ( otherSwitch , true ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( otherSwitch , true ) ) ;
/ / 另一道岔联动道岔也需要
/ / 另一道岔联动道岔也需要
Switch otherLinkSwitch = otherSwitch . queryLinkedSwitch ( ) ;
Switch otherLinkSwitch = otherSwitch . queryLinkedSwitch ( ) ;
@ -1900,7 +2025,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
rpPath . addSwitchElement ( new SwitchElement ( otherLinkSwitch , true ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( otherLinkSwitch , true ) ) ;
}
}
}
}
getRoutePathOf ( startSignal , relSwitch . getC ( ) . getSectionOf ( right ) , ground , rpPath , routePathList , config , errorList ) ;
getRoutePathOf ( startSignal , relSwitch . getC ( ) . getSectionOf ( right ) , ground , rpPath ,
routePathList , config , errorList ) ;
} else if ( relSwitch . isB ( section ) ) {
} else if ( relSwitch . isB ( section ) ) {
/ / 只有一条路径 , 从B - > A , 道岔定位
/ / 只有一条路径 , 从B - > A , 道岔定位
tempPath . addSection ( relSwitch . getA ( ) ) ;
tempPath . addSection ( relSwitch . getA ( ) ) ;
@ -1909,7 +2035,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if ( ! config . isGenerateFls ( ) & & Objects . nonNull ( linkedSwitch ) ) {
if ( ! config . isGenerateFls ( ) & & Objects . nonNull ( linkedSwitch ) ) {
tempPath . addSwitchElement ( new SwitchElement ( linkedSwitch , true ) ) ;
tempPath . addSwitchElement ( new SwitchElement ( linkedSwitch , true ) ) ;
}
}
getRoutePathOf ( startSignal , relSwitch . getA ( ) . getSectionOf ( right ) , ground , tempPath , routePathList , config , errorList ) ;
getRoutePathOf ( startSignal , relSwitch . getA ( ) . getSectionOf ( right ) , ground , tempPath ,
routePathList , config , errorList ) ;
} else if ( relSwitch . isC ( section ) ) {
} else if ( relSwitch . isC ( section ) ) {
/ / 只有一条路径 , 从C - > A , 道岔反位
/ / 只有一条路径 , 从C - > A , 道岔反位
tempPath . addSection ( relSwitch . getA ( ) ) ;
tempPath . addSection ( relSwitch . getA ( ) ) ;
@ -1927,9 +2054,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
tempPath . addSwitchElement ( new SwitchElement ( otherLinkSwitch , true ) ) ;
tempPath . addSwitchElement ( new SwitchElement ( otherLinkSwitch , true ) ) ;
}
}
}
}
getRoutePathOf ( startSignal , relSwitch . getA ( ) . getSectionOf ( right ) , ground , tempPath , routePathList , config , errorList ) ;
getRoutePathOf ( startSignal , relSwitch . getA ( ) . getSectionOf ( right ) , ground , tempPath ,
routePathList , config , errorList ) ;
} else {
} else {
errorList . add ( String . format ( " 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
errorList . add ( String . format (
" 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
section . getName ( ) , section . getCode ( ) ,
section . getName ( ) , section . getCode ( ) ,
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
return ;
return ;
@ -1957,7 +2086,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
if ( Objects . isNull ( section ) ) {
if ( Objects . isNull ( section ) ) {
Signal lastSignal = tempPath . getLastSection ( ) . getSignalOf ( ! right ) ;
Signal lastSignal = tempPath . getLastSection ( ) . getSignalOf ( ! right ) ;
if ( Objects . nonNull ( lastSignal ) & & lastSignal . getType ( ) . equals ( Signal . SignalType . SHUNTING2 ) ) {
if ( Objects . nonNull ( lastSignal ) & & lastSignal . getType ( )
. equals ( Signal . SignalType . SHUNTING2 ) ) {
routePathList . add ( tempPath ) ;
routePathList . add ( tempPath ) ;
}
}
return ;
return ;
@ -1997,7 +2127,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if ( Objects . nonNull ( linkedSwitch ) ) {
if ( Objects . nonNull ( linkedSwitch ) ) {
npPath . addSwitchElement ( new SwitchElement ( linkedSwitch , true ) ) ;
npPath . addSwitchElement ( new SwitchElement ( linkedSwitch , true ) ) ;
}
}
getRoutePathOfDepot ( startSignal , relSwitch . getB ( ) . getSectionOf ( right ) , npPath , routePathList , config , errorList ) ;
getRoutePathOfDepot ( startSignal , relSwitch . getB ( ) . getSectionOf ( right ) , npPath ,
routePathList , config , errorList ) ;
SectionPath rpPath = tempPath . cloneNew ( ) ; / / 反位路径
SectionPath rpPath = tempPath . cloneNew ( ) ; / / 反位路径
rpPath . addSection ( relSwitch . getC ( ) ) ;
rpPath . addSection ( relSwitch . getC ( ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( relSwitch , false ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( relSwitch , false ) ) ;
@ -2011,7 +2142,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
rpPath . addSwitchElement ( new SwitchElement ( otherLinkSwitch , true ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( otherLinkSwitch , true ) ) ;
}
}
}
}
getRoutePathOfDepot ( startSignal , relSwitch . getC ( ) . getSectionOf ( right ) , rpPath , routePathList , config , errorList ) ;
getRoutePathOfDepot ( startSignal , relSwitch . getC ( ) . getSectionOf ( right ) , rpPath ,
routePathList , config , errorList ) ;
} else if ( relSwitch . isB ( section ) ) {
} else if ( relSwitch . isB ( section ) ) {
/ / 只有一条路径 , 从B - > A , 道岔定位
/ / 只有一条路径 , 从B - > A , 道岔定位
tempPath . addSection ( relSwitch . getA ( ) ) ;
tempPath . addSection ( relSwitch . getA ( ) ) ;
@ -2020,7 +2152,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if ( Objects . nonNull ( linkedSwitch ) ) {
if ( Objects . nonNull ( linkedSwitch ) ) {
tempPath . addSwitchElement ( new SwitchElement ( linkedSwitch , true ) ) ;
tempPath . addSwitchElement ( new SwitchElement ( linkedSwitch , true ) ) ;
}
}
getRoutePathOfDepot ( startSignal , relSwitch . getA ( ) . getSectionOf ( right ) , tempPath , routePathList , config , errorList ) ;
getRoutePathOfDepot ( startSignal , relSwitch . getA ( ) . getSectionOf ( right ) , tempPath ,
routePathList , config , errorList ) ;
} else if ( relSwitch . isC ( section ) ) {
} else if ( relSwitch . isC ( section ) ) {
/ / 只有一条路径 , 从C - > A , 道岔反位
/ / 只有一条路径 , 从C - > A , 道岔反位
tempPath . addSection ( relSwitch . getA ( ) ) ;
tempPath . addSection ( relSwitch . getA ( ) ) ;
@ -2035,9 +2168,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
tempPath . addSwitchElement ( new SwitchElement ( otherLinkSwitch , true ) ) ;
tempPath . addSwitchElement ( new SwitchElement ( otherLinkSwitch , true ) ) ;
}
}
}
}
getRoutePathOfDepot ( startSignal , relSwitch . getA ( ) . getSectionOf ( right ) , tempPath , routePathList , config , errorList ) ;
getRoutePathOfDepot ( startSignal , relSwitch . getA ( ) . getSectionOf ( right ) , tempPath ,
routePathList , config , errorList ) ;
} else {
} else {
errorList . add ( String . format ( " 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
errorList . add ( String . format (
" 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
section . getName ( ) , section . getCode ( ) ,
section . getName ( ) , section . getCode ( ) ,
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
return ;
return ;
@ -2070,7 +2205,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List < Section > logicApproachList = new ArrayList < > ( ) ;
List < Section > logicApproachList = new ArrayList < > ( ) ;
List < Section > sectionList = sectionPath . getSectionList ( ) ;
List < Section > sectionList = sectionPath . getSectionList ( ) ;
for ( Section phySection : sectionList ) {
for ( Section phySection : sectionList ) {
if ( len > = 600 ) break ;
if ( len > = 600 ) {
break ;
}
if ( phySection . isSwitchTrack ( ) ) {
if ( phySection . isSwitchTrack ( ) ) {
len + = phySection . getLen ( ) ;
len + = phySection . getLen ( ) ;
logicApproachList . add ( phySection ) ;
logicApproachList . add ( phySection ) ;
@ -2089,7 +2226,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
for ( Section logic : sortedList ) {
for ( Section logic : sortedList ) {
logicApproachList . add ( logic ) ;
logicApproachList . add ( logic ) ;
len + = logic . getLen ( ) ;
len + = logic . getLen ( ) ;
if ( len > = 600 ) break ;
if ( len > = 600 ) {
break ;
}
}
}
}
}
sectionPath . setLogicList ( logicApproachList ) ;
sectionPath . setLogicList ( logicApproachList ) ;
@ -2098,7 +2237,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
signal . setRouteReleaseTime ( config . getRouteReleaseTime ( ) ) ;
signal . setRouteReleaseTime ( config . getRouteReleaseTime ( ) ) ;
}
}
public void getApproachPathOf ( Section section , boolean right , Float distance , SectionPath tempPath , MapCiGenerateConfig config , List < SectionPath > results ) {
public void getApproachPathOf ( Section section , boolean right , Float distance ,
SectionPath tempPath , MapCiGenerateConfig config , List < SectionPath > results ) {
if ( ! CollectionUtils . isEmpty ( tempPath . getSectionList ( ) ) ) {
if ( ! CollectionUtils . isEmpty ( tempPath . getSectionList ( ) ) ) {
/ / 已经有区段了
/ / 已经有区段了
if ( Objects . isNull ( section ) ) {
if ( Objects . isNull ( section ) ) {
@ -2110,7 +2250,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
return ;
return ;
}
}
}
}
if ( config . isSignalApproachNotPassPreSignal ( ) & & Objects . nonNull ( section . getSignalOf ( ! right ) ) ) {
if ( config . isSignalApproachNotPassPreSignal ( ) & & Objects . nonNull (
section . getSignalOf ( ! right ) ) ) {
results . add ( tempPath ) ;
results . add ( tempPath ) ;
return ;
return ;
}
}
@ -2131,33 +2272,39 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
SectionPath npPath = tempPath . cloneNew ( ) ; / / 定位路径
SectionPath npPath = tempPath . cloneNew ( ) ; / / 定位路径
npPath . addSection ( relSwitch . getB ( ) ) ;
npPath . addSection ( relSwitch . getB ( ) ) ;
npPath . addSwitchElement ( new SwitchElement ( relSwitch , true ) ) ;
npPath . addSwitchElement ( new SwitchElement ( relSwitch , true ) ) ;
getApproachPathOf ( relSwitch . getB ( ) . getSectionOf ( right ) , right , distance , npPath , config , results ) ;
getApproachPathOf ( relSwitch . getB ( ) . getSectionOf ( right ) , right , distance , npPath , config ,
results ) ;
if ( ! config . isSignalApproachOnlyNpSwitch ( ) ) {
if ( ! config . isSignalApproachOnlyNpSwitch ( ) ) {
SectionPath rpPath = tempPath . cloneNew ( ) ; / / 反位路径
SectionPath rpPath = tempPath . cloneNew ( ) ; / / 反位路径
rpPath . addSection ( relSwitch . getC ( ) ) ;
rpPath . addSection ( relSwitch . getC ( ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( relSwitch , false ) ) ;
rpPath . addSwitchElement ( new SwitchElement ( relSwitch , false ) ) ;
getApproachPathOf ( relSwitch . getC ( ) . getSectionOf ( right ) , right , distance , rpPath , config , results ) ;
getApproachPathOf ( relSwitch . getC ( ) . getSectionOf ( right ) , right , distance , rpPath , config ,
results ) ;
}
}
} else if ( relSwitch . isB ( section ) ) {
} else if ( relSwitch . isB ( section ) ) {
/ / 只有一条路径 , 从B - > A , 道岔定位
/ / 只有一条路径 , 从B - > A , 道岔定位
tempPath . addSection ( section ) ;
tempPath . addSection ( section ) ;
tempPath . addSection ( relSwitch . getA ( ) ) ;
tempPath . addSection ( relSwitch . getA ( ) ) ;
tempPath . addSwitchElement ( new SwitchElement ( relSwitch , true ) ) ;
tempPath . addSwitchElement ( new SwitchElement ( relSwitch , true ) ) ;
getApproachPathOf ( relSwitch . getA ( ) . getSectionOf ( right ) , right , distance , tempPath , config , results ) ;
getApproachPathOf ( relSwitch . getA ( ) . getSectionOf ( right ) , right , distance , tempPath , config ,
results ) ;
} else if ( relSwitch . isC ( section ) ) {
} else if ( relSwitch . isC ( section ) ) {
if ( ! config . isSignalApproachOnlyNpSwitch ( ) | | CollectionUtils . isEmpty ( tempPath . getSectionList ( ) ) ) {
if ( ! config . isSignalApproachOnlyNpSwitch ( ) | | CollectionUtils . isEmpty (
tempPath . getSectionList ( ) ) ) {
/ / 只有一条路径 , 从C - > A , 道岔反位
/ / 只有一条路径 , 从C - > A , 道岔反位
tempPath . addSection ( section ) ;
tempPath . addSection ( section ) ;
tempPath . addSection ( relSwitch . getA ( ) ) ;
tempPath . addSection ( relSwitch . getA ( ) ) ;
tempPath . addSwitchElement ( new SwitchElement ( relSwitch , false ) ) ;
tempPath . addSwitchElement ( new SwitchElement ( relSwitch , false ) ) ;
getApproachPathOf ( relSwitch . getA ( ) . getSectionOf ( right ) , right , distance , tempPath , config , results ) ;
getApproachPathOf ( relSwitch . getA ( ) . getSectionOf ( right ) , right , distance , tempPath , config ,
results ) ;
} else {
} else {
results . add ( tempPath ) ;
results . add ( tempPath ) ;
return ;
return ;
}
}
} else {
} else {
throw BusinessExceptionAssertEnum . DATA_ERROR . exception (
throw BusinessExceptionAssertEnum . DATA_ERROR . exception (
String . format ( " 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
String . format (
" 地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段 " ,
section . getName ( ) , section . getCode ( ) ,
section . getName ( ) , section . getCode ( ) ,
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
relSwitch . getName ( ) , relSwitch . getCode ( ) ) ) ;
}
}
@ -2175,7 +2322,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param autoSignalGenerator
* @param autoSignalGenerator
* @param errorList
* @param errorList
* /
* /
private AutoSignal generateAutoSignal ( Signal signal , CodeGenerator autoSignalGenerator , List < String > errorList ) {
private AutoSignal generateAutoSignal ( Signal signal , CodeGenerator autoSignalGenerator ,
List < String > errorList ) {
AutoSignal autoSignal = new AutoSignal ( autoSignalGenerator . next ( ) ) ;
AutoSignal autoSignal = new AutoSignal ( autoSignalGenerator . next ( ) ) ;
autoSignal . setSignal ( signal ) ;
autoSignal . setSignal ( signal ) ;
List < Section > sectionList = new ArrayList < > ( ) ;
List < Section > sectionList = new ArrayList < > ( ) ;
@ -2203,10 +2351,12 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
sectionList . add ( nextSwitchSection ) ;
sectionList . add ( nextSwitchSection ) ;
Section next2 = nextSwitchSection . getSectionOf ( right ) ;
Section next2 = nextSwitchSection . getSectionOf ( right ) ;
if ( Objects . nonNull ( next2 ) & & Objects . equals ( next2 . getParent ( ) , nextSwitchSection . getParent ( ) ) ) {
if ( Objects . nonNull ( next2 ) & & Objects . equals ( next2 . getParent ( ) ,
nextSwitchSection . getParent ( ) ) ) {
/ / 是同一计轴区段 , 添加下一个道岔区段
/ / 是同一计轴区段 , 添加下一个道岔区段
sectionList . add ( next2 ) ;
sectionList . add ( next2 ) ;
sectionList . add ( next2 . getRelSwitch ( ) . getNextSectionOnBaseSectionAndPosition ( next2 , true ) ) ;
sectionList . add (
next2 . getRelSwitch ( ) . getNextSectionOnBaseSectionAndPosition ( next2 , true ) ) ;
}
}
}
}
break ;
break ;