Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtsts-server-go
This commit is contained in:
commit
cb950c8e58
@ -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
|
||||||
|
}
|
@ -152,6 +152,7 @@ func (s *VerifySimulation) GetAllState(mapId int32) *state.PushedDevicesStatus {
|
|||||||
SignalState: GetMapAllSignalState(s, mapId),
|
SignalState: GetMapAllSignalState(s, mapId),
|
||||||
ButtonState: GetMapAllStationButtonState(s, mapId),
|
ButtonState: GetMapAllStationButtonState(s, mapId),
|
||||||
PsdState: GetMapAllPsdState(s, mapId),
|
PsdState: GetMapAllPsdState(s, mapId),
|
||||||
|
SectionState: GetMapAllSectionState(s, mapId),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
case graphicData.PictureType_RelayCabinetLayout:
|
case graphicData.PictureType_RelayCabinetLayout:
|
||||||
|
Loading…
Reference in New Issue
Block a user