仿真模块物理区段增加a/b端LinkPosition;修改北京测试项目数据构建逻辑(未完)

This commit is contained in:
joylink_zhangsai 2023-09-22 10:29:42 +08:00
parent 0ada384fc7
commit f7fed18931
4 changed files with 31 additions and 22 deletions

View File

@ -21,7 +21,8 @@ import (
) )
var ( var (
graphicStorageMap sync.Map giTypeMap sync.Map
giDataMap sync.Map
graphicMapElementIdMap sync.Map graphicMapElementIdMap sync.Map
//// 仿真存储集合 ID //// 仿真存储集合 ID
//graphicDataMap sync.Map //graphicDataMap sync.Map
@ -101,24 +102,36 @@ type calcLinkPositionStruct struct {
// 将发布的地图数据放入内存中 // 将发布的地图数据放入内存中
func PublishMapVerifyStructure(graphic *model.PublishedGi) { func PublishMapVerifyStructure(graphic *model.PublishedGi) {
graphicStorage := &graphicData.RtssGraphicStorage{} giTypeMap.Store(graphic.ID, graphic.Type)
err := proto.Unmarshal(graphic.Proto, graphicStorage) var message proto.Message
switch graphicData.PictureType(graphic.Type) {
case graphicData.PictureType_StationLayout:
message = &graphicData.RtssGraphicStorage{}
case graphicData.PictureType_RelayCabinetLayout:
message = &graphicData.RelayCabinetGraphicStorage{}
case graphicData.PictureType_Psl:
message = &graphicData.PslGraphicStorage{}
}
err := proto.Unmarshal(graphic.Proto, message)
if err != nil { if err != nil {
panic(fmt.Sprintf("proto数据反序列化失败%s", err)) panic(fmt.Sprintf("[id:%d]proto数据反序列化失败%s", graphic.ID, err))
} }
graphicStorageMap.Store(graphic.ID, graphicStorage) giDataMap.Store(graphic.ID, message)
// 初始化地图结构 // 初始化地图结构
mapElementIdStructure := &GraphicMapElementIdStructure{ if graphicData.PictureType(graphic.Type) == graphicData.PictureType_StationLayout {
AxlePointIds: make(map[string]*ElementIdStructure), graphicStorage := message.(*graphicData.RtssGraphicStorage)
TurnoutIds: make(map[string]*ElementIdStructure), mapElementIdStructure := &GraphicMapElementIdStructure{
PhysicalSectionIds: make(map[string]*ElementIdStructure), AxlePointIds: make(map[string]*ElementIdStructure),
SignalIds: make(map[string]*ElementIdStructure), TurnoutIds: make(map[string]*ElementIdStructure),
TransponderIds: make(map[string]*ElementIdStructure), PhysicalSectionIds: make(map[string]*ElementIdStructure),
SlopeIds: make(map[string]*ElementIdStructure), SignalIds: make(map[string]*ElementIdStructure),
CurvatureIds: make(map[string]*ElementIdStructure), TransponderIds: make(map[string]*ElementIdStructure),
SlopeIds: make(map[string]*ElementIdStructure),
CurvatureIds: make(map[string]*ElementIdStructure),
}
initGraphicStructure(graphicStorage, mapElementIdStructure)
graphicMapElementIdMap.Store(graphic.ID, mapElementIdStructure)
} }
initGraphicStructure(graphicStorage, mapElementIdStructure)
graphicMapElementIdMap.Store(graphic.ID, mapElementIdStructure)
} }
// 通过地图Index获取Uid // 通过地图Index获取Uid
@ -263,7 +276,7 @@ func DeleteMapVerifyStructure(mapId int32) {
} }
func QueryGraphicStorage(mapId int32) *graphicData.RtssGraphicStorage { func QueryGraphicStorage(mapId int32) *graphicData.RtssGraphicStorage {
value, ok := graphicStorageMap.Load(mapId) value, ok := giDataMap.Load(mapId)
if ok { if ok {
return value.(*graphicData.RtssGraphicStorage) return value.(*graphicData.RtssGraphicStorage)
} }

View File

@ -107,10 +107,6 @@ func buildProtoRepository(storages []*graphicData.RtssGraphicStorage, mapIds []i
func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) { func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) {
axleCountingMap := make(map[string]*graphicData.AxleCounting) axleCountingMap := make(map[string]*graphicData.AxleCounting)
for _, data := range storage.AxleCountings { for _, data := range storage.AxleCountings {
if data.KilometerSystem == nil {
println(fmt.Sprintf("计轴[%s]缺少公里标", data.Common.Id))
continue
}
axleCountingMap[data.Common.Id] = data axleCountingMap[data.Common.Id] = data
cpType := proto.CheckPointType_AxleCounter cpType := proto.CheckPointType_AxleCounter
if data.Type == graphicData.AxleCounting_SectionBoundary { if data.Type == graphicData.AxleCounting_SectionBoundary {

@ -1 +1 @@
Subproject commit 473f7da13f142c51c774149002e5b8752b0e6825 Subproject commit 0413df374c5d01759e53bee16490866a17882f5f

@ -1 +1 @@
Subproject commit 1720d6ba5ba4a0122d5374e86c4da17447b1e59d Subproject commit 599de9a68807f59283bd4cc3f026ba4fbbb9f66a