计轴区段状态推送
This commit is contained in:
parent
18b15ad619
commit
17143a20a3
@ -0,0 +1,38 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
)
|
||||
|
||||
func GetMapAllSectionState(sim *VerifySimulation, mapId int32) []*state.SectionState {
|
||||
uidMap := QueryMapUidMapByType(mapId, &graphicData.Section{})
|
||||
var sectionArr []*state.SectionState
|
||||
for _, u := range uidMap {
|
||||
s := handlerSectionState(sim.World, u.Uid)
|
||||
if s == nil {
|
||||
continue
|
||||
}
|
||||
s.Id = u.CommonId
|
||||
sectionArr = append(sectionArr, s)
|
||||
}
|
||||
return sectionArr
|
||||
}
|
||||
func handlerSectionState(w ecs.World, uid string) *state.SectionState {
|
||||
entry, ok := entity.GetEntityByUid(w, uid)
|
||||
if !ok {
|
||||
//fmt.Printf("id=%s的信号机不存在", uid)
|
||||
return nil
|
||||
}
|
||||
if entry.HasComponent(component.AxleSectionTag) { //计轴区段
|
||||
sectionState := &state.SectionState{}
|
||||
axleState := component.AxleSectionStateType.Get(entry)
|
||||
sectionState.Occupied = axleState.Occ
|
||||
sectionState.Type = state.SectionType_Axle
|
||||
return sectionState
|
||||
}
|
||||
return nil
|
||||
}
|
@ -147,11 +147,12 @@ func (s *VerifySimulation) GetAllState(mapId int32) *state.PushedDevicesStatus {
|
||||
return &state.PushedDevicesStatus{
|
||||
All: true,
|
||||
AllStatus: &state.AllDevicesStatus{
|
||||
SwitchState: GetMapAllTurnoutState(s, mapId),
|
||||
TrainState: GetAllTrainState(s),
|
||||
SignalState: GetMapAllSignalState(s, mapId),
|
||||
ButtonState: GetMapAllStationButtonState(s, mapId),
|
||||
PsdState: GetMapAllPsdState(s, mapId),
|
||||
SwitchState: GetMapAllTurnoutState(s, mapId),
|
||||
TrainState: GetAllTrainState(s),
|
||||
SignalState: GetMapAllSignalState(s, mapId),
|
||||
ButtonState: GetMapAllStationButtonState(s, mapId),
|
||||
PsdState: GetMapAllPsdState(s, mapId),
|
||||
SectionState: GetMapAllSectionState(s, mapId),
|
||||
},
|
||||
}
|
||||
case graphicData.PictureType_RelayCabinetLayout:
|
||||
|
Loading…
Reference in New Issue
Block a user