【修改UID生成逻辑】

This commit is contained in:
weizhihong 2023-09-22 15:15:04 +08:00
parent 7bdadac08d
commit 58a7d87a8c
4 changed files with 280 additions and 225 deletions

View File

@ -3,8 +3,6 @@ package memory
import (
"fmt"
"math"
"sort"
"strings"
"sync"
"joylink.club/rtsssimulation/repository"
@ -21,31 +19,10 @@ import (
)
var (
giTypeMap sync.Map
giDataMap sync.Map
graphicMapElementIdMap sync.Map
//// 仿真存储集合 ID
//graphicDataMap sync.Map
//graphicSourceDataMap sync.Map
giTypeMap sync.Map
giDataMap sync.Map
)
type ElementIdStructure struct {
CommonId string
Index int32
Uid string
}
// 数组为Index为 common.Id, index, uid
type GraphicMapElementIdStructure struct {
AxlePointIds map[string]*ElementIdStructure
TurnoutIds map[string]*ElementIdStructure
PhysicalSectionIds map[string]*ElementIdStructure
SignalIds map[string]*ElementIdStructure
TransponderIds map[string]*ElementIdStructure
SlopeIds map[string]*ElementIdStructure
CurvatureIds map[string]*ElementIdStructure
}
// VerifyStructure 轨旁仿真模型结构
type VerifyStructure struct {
//计轴检测点设备模型集合,key为索引编号
@ -72,26 +49,6 @@ type VerifyStructure struct {
PointMap map[string]*device.PointModel
}
// GraphicInfoMapStructure 设备地图ID对应map结构体(建立关系时便于查找使用)
type GraphicInfoMapStructure struct {
AxlePointMap map[string]*graphicData.AxleCounting
TurnoutMap map[string]*graphicData.Turnout
SectionLinkMap map[string]*graphicData.SectionLink
AxleSectionMap map[string]*graphicData.AxleCountingSection
PhysicalSectionMap map[string]*graphicData.Section
LogicSectionMap map[string]*graphicData.LogicSection
SignalMap map[string]*graphicData.Signal
TransponderMap map[string]*graphicData.Transponder
SlopeMap map[string]*graphicData.Slope
SlopeKiloMarkerMap map[string]*graphicData.SlopeKiloMarker
CurvatureMap map[string]*graphicData.Curvature
CurvatureKiloMarkerMap map[string]*graphicData.CurvatureKiloMarker
//key-index
CalcLinkMap map[int32]*graphicData.CalculateLink
//设备在link上的位置。key-设备id
DevicePositionMap map[string]*ref.DevicePosition[*device.LinkModel]
}
// 计算link、物理区段、道岔相互转换时用到的结构体
type calcLinkPositionStruct struct {
index string // 地图元素的Index
@ -118,157 +75,16 @@ func PublishMapVerifyStructure(graphic *model.PublishedGi) {
}
giDataMap.Store(graphic.ID, message)
// 初始化地图结构
if graphicData.PictureType(graphic.Type) == graphicData.PictureType_StationLayout {
switch graphicData.PictureType(graphic.Type) {
case graphicData.PictureType_StationLayout:
graphicStorage := message.(*graphicData.RtssGraphicStorage)
mapElementIdStructure := &GraphicMapElementIdStructure{
AxlePointIds: make(map[string]*ElementIdStructure),
TurnoutIds: make(map[string]*ElementIdStructure),
PhysicalSectionIds: make(map[string]*ElementIdStructure),
SignalIds: 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)
giUidMap.Store(graphic.ID, initStationUid(graphicStorage))
case graphicData.PictureType_RelayCabinetLayout:
graphicStorage := message.(*graphicData.RelayCabinetGraphicStorage)
giUidMap.Store(graphic.ID, initRelayCabinetUid(graphicStorage))
}
}
// 通过地图Index获取Uid
func GetDeviceUidByIndex(mapId, index int32, m interface{}) string {
elementIdMap := getElementIdStructure(mapId, m)
for _, elementId := range elementIdMap {
if elementId.Index == index {
return elementId.Uid
}
}
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: "无ID映射信息"})
}
// 通过地图CommonId获取Uid
func GetDeviceUidByCommonId(mapId int32, commonId string, m interface{}) string {
elementIdMap := getElementIdStructure(mapId, m)
elementId := elementIdMap[commonId]
if elementId != nil {
return elementId.Uid
}
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: "无ID映射信息"})
}
// 根据Uid获取地图Index
func GetDeviceIndexByUid(mapId int32, uid string, m interface{}) int32 {
elementIdMap := getElementIdStructure(mapId, m)
for _, elementId := range elementIdMap {
if elementId.Uid == uid {
return elementId.Index
}
}
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: "无ID映射信息"})
}
// 获取元素的UID映射
func getElementIdStructure(mapId int32, m interface{}) map[string]*ElementIdStructure {
idStructure := getMapElementIdMap(mapId)
switch m.(type) {
case *graphicData.AxleCounting:
return idStructure.AxlePointIds
case *graphicData.Turnout:
return idStructure.TurnoutIds
case *graphicData.Section:
return idStructure.PhysicalSectionIds
case *graphicData.Signal:
return idStructure.SignalIds
case *graphicData.Transponder:
return idStructure.TransponderIds
case *graphicData.Slope:
return idStructure.SlopeIds
case *graphicData.Curvature:
return idStructure.CurvatureIds
default:
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "元素类型未映射ID"})
}
}
func getMapElementIdMap(mapId int32) *GraphicMapElementIdStructure {
mapElementIdMap, ok := graphicMapElementIdMap.Load(mapId)
if !ok {
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: "无ID映射信息"})
}
return mapElementIdMap.(*GraphicMapElementIdStructure)
}
// 初始化地图结构
func initGraphicStructure(graphicData *graphicData.RtssGraphicStorage, mapElementIdMap *GraphicMapElementIdStructure) {
// 初始化计轴信息
for _, a := range graphicData.AxleCountings {
mapElementIdMap.AxlePointIds[a.Common.Id] = &ElementIdStructure{
CommonId: a.Common.Id,
Index: a.Index,
Uid: generateElementUid(graphicData.UniqueIdPrefix, a.Common.Id, a.CentralizedStations),
}
}
// 初始化道岔信息
for _, t := range graphicData.Turnouts {
mapElementIdMap.TurnoutIds[t.Common.Id] = &ElementIdStructure{
CommonId: t.Common.Id,
Index: t.Index,
Uid: generateElementUid(graphicData.UniqueIdPrefix, t.Common.Id, t.CentralizedStations),
}
}
// 初始化物理区段信息
for _, s := range graphicData.Section {
mapElementIdMap.PhysicalSectionIds[s.Common.Id] = &ElementIdStructure{
CommonId: s.Common.Id,
Index: s.Index,
Uid: generateElementUid(graphicData.UniqueIdPrefix, s.Common.Id, s.CentralizedStations),
}
}
// 初始化信号机信息
for _, s := range graphicData.Signals {
mapElementIdMap.SignalIds[s.Common.Id] = &ElementIdStructure{
CommonId: s.Common.Id,
Index: s.Index,
Uid: generateElementUid(graphicData.UniqueIdPrefix, s.Common.Id, s.CentralizedStations),
}
}
// 初始化应答器
for _, t := range graphicData.Transponders {
mapElementIdMap.TransponderIds[t.Common.Id] = &ElementIdStructure{
CommonId: t.Common.Id,
Index: t.Index,
Uid: generateElementUid(graphicData.UniqueIdPrefix, t.Common.Id, t.CentralizedStations),
}
}
// 初始化坡度
for _, s := range graphicData.Slopes {
mapElementIdMap.SlopeIds[s.Common.Id] = &ElementIdStructure{
CommonId: s.Common.Id,
Index: 0,
Uid: generateElementUid(graphicData.UniqueIdPrefix, s.Common.Id, nil),
}
}
// 初始化曲线
for _, c := range graphicData.Curvatures {
mapElementIdMap.CurvatureIds[c.Common.Id] = &ElementIdStructure{
CommonId: c.Common.Id,
Index: 0,
Uid: generateElementUid(graphicData.UniqueIdPrefix, c.Common.Id, nil),
}
}
}
// 生成Uid, 等加上集中站再做修改
func generateElementUid(ui *graphicData.UniqueIdOfStationLayout, code string, stationName []string) string {
sort.Strings(stationName)
var idArr []string
if ui != nil {
idArr = append(idArr, ui.City, ui.LineId)
}
idArr = append(idArr, stationName...)
idArr = append(idArr, code)
return strings.Join(idArr, "_")
}
// 移除内存中的地图信息
func DeleteMapVerifyStructure(mapId int32) {
//graphicDataMap.Delete(mapId)
@ -420,6 +236,8 @@ Outter:
panic(dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("link【%d】缺失道岔【id:%s,index:%s】端口【%s】偏移量", linkId, turnoutModel.GraphicId, id, port)})
}
func QueryEcsLinkByDeviceInfo() {}
// 根据linkID和link相对偏移量返回区段道岔偏移量
// 设备ID、端口、偏移量、上下行、AB走向
func QueryDeviceByCalcLink(repo *repository.Repository, id string, offset int64, up bool) (

View File

@ -0,0 +1,241 @@
package memory
import (
"fmt"
"log"
"reflect"
"sort"
"strings"
"sync"
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
"joylink.club/bj-rtsts-server/dto"
)
var giUidMap sync.Map
type elementIdStructure struct {
CommonId string
Index int32
Code string
Uid string
}
// 数组为Index为 common.Id, index, uid
type stationUidStructure struct {
AxlePointIds map[string]*elementIdStructure
TurnoutIds map[string]*elementIdStructure
PhysicalSectionIds map[string]*elementIdStructure
SignalIds map[string]*elementIdStructure
TransponderIds map[string]*elementIdStructure
SlopeIds map[string]*elementIdStructure
CurvatureIds map[string]*elementIdStructure
}
type relayUidStructure struct {
RelayCabinetIds map[string]*elementIdStructure
RelayIds map[string]*elementIdStructure
RelayRefIds map[string]*elementIdStructure
}
// 获取UID的前缀信息
func getUIdPrefix(prefix interface{}) string {
if prefix == nil {
log.Fatalf("缺少UID前缀设置")
return ""
}
switch prefix.(type) {
case *graphicData.UniqueIdOfStationLayout:
p := prefix.(*graphicData.UniqueIdOfStationLayout)
return p.City + "_" + p.LineId
case *graphicData.UniqueIdType:
p := prefix.(*graphicData.UniqueIdType)
return p.City + "_" + p.LineId + "_" + p.BelongsConcentrationStation
default:
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "错误前缀设置"})
}
}
// 生成Uid, 等加上集中站再做修改
func generateElementUid(uidPrefix, code string, stationName []string) string {
sort.Strings(stationName)
var idArr []string
idArr = append(idArr, uidPrefix)
idArr = append(idArr, stationName...)
idArr = append(idArr, code)
return strings.Join(idArr, "_")
}
// 初始化平面布置图 UID
func initStationUid(graphicData *graphicData.RtssGraphicStorage) *stationUidStructure {
gus := &stationUidStructure{
AxlePointIds: make(map[string]*elementIdStructure, len(graphicData.AxleCountings)),
TurnoutIds: make(map[string]*elementIdStructure, len(graphicData.Turnouts)),
PhysicalSectionIds: make(map[string]*elementIdStructure, len(graphicData.Section)),
SignalIds: make(map[string]*elementIdStructure, len(graphicData.Signals)),
TransponderIds: make(map[string]*elementIdStructure, len(graphicData.Transponders)),
SlopeIds: make(map[string]*elementIdStructure, len(graphicData.Slopes)),
CurvatureIds: make(map[string]*elementIdStructure, len(graphicData.Curvatures)),
}
uidPrefix := getUIdPrefix(graphicData.UniqueIdPrefix)
// 初始化计轴信息
for _, a := range graphicData.AxleCountings {
gus.AxlePointIds[a.Common.Id] = &elementIdStructure{
CommonId: a.Common.Id,
Index: a.Index,
Uid: generateElementUid(uidPrefix, a.Code, a.CentralizedStations),
}
}
// 初始化道岔信息
for _, t := range graphicData.Turnouts {
gus.TurnoutIds[t.Common.Id] = &elementIdStructure{
CommonId: t.Common.Id,
Index: t.Index,
Uid: generateElementUid(uidPrefix, t.Code, t.CentralizedStations),
}
}
// 初始化物理区段信息
for _, s := range graphicData.Section {
gus.PhysicalSectionIds[s.Common.Id] = &elementIdStructure{
CommonId: s.Common.Id,
Index: s.Index,
Uid: generateElementUid(uidPrefix, s.Code, s.CentralizedStations),
}
}
// 初始化信号机信息
for _, s := range graphicData.Signals {
gus.SignalIds[s.Common.Id] = &elementIdStructure{
CommonId: s.Common.Id,
Index: s.Index,
Uid: generateElementUid(uidPrefix, s.Code, s.CentralizedStations),
}
}
// 初始化应答器
for _, t := range graphicData.Transponders {
gus.TransponderIds[t.Common.Id] = &elementIdStructure{
CommonId: t.Common.Id,
Index: t.Index,
Uid: generateElementUid(uidPrefix, t.Code, t.CentralizedStations),
}
}
// 初始化坡度
for _, s := range graphicData.Slopes {
gus.SlopeIds[s.Common.Id] = &elementIdStructure{
CommonId: s.Common.Id,
Uid: generateElementUid(uidPrefix, s.Common.Id, nil),
}
}
// 初始化曲线
for _, c := range graphicData.Curvatures {
gus.CurvatureIds[c.Common.Id] = &elementIdStructure{
CommonId: c.Common.Id,
Uid: generateElementUid(uidPrefix, c.Common.Id, nil),
}
}
return gus
}
// 初始化继电器柜 UID
func initRelayCabinetUid(graphicData *graphicData.RelayCabinetGraphicStorage) *relayUidStructure {
rus := &relayUidStructure{
RelayCabinetIds: make(map[string]*elementIdStructure, len(graphicData.RelayCabinets)),
RelayIds: make(map[string]*elementIdStructure, len(graphicData.Relays)),
RelayRefIds: make(map[string]*elementIdStructure, len(graphicData.DeviceRelateRelayList)),
}
uidPrefix := getUIdPrefix(graphicData.UniqueIdPrefix)
for _, r := range graphicData.RelayCabinets {
rus.RelayCabinetIds[r.Common.Id] = &elementIdStructure{
CommonId: r.Common.Id,
Code: r.Code,
Uid: generateElementUid(uidPrefix, r.Code, nil),
}
}
for _, r := range graphicData.Relays {
rus.RelayIds[r.Common.Id] = &elementIdStructure{
CommonId: r.Common.Id,
Code: r.Code,
Uid: generateElementUid(uidPrefix, r.Code, nil),
}
}
for _, r := range graphicData.DeviceRelateRelayList {
rus.RelayRefIds[r.Code] = &elementIdStructure{
Code: r.Code,
Uid: generateElementUid(uidPrefix, r.Code, nil),
}
}
return rus
}
// 获取地图UID的映射集合
func queryUidStructure[T *stationUidStructure | *relayUidStructure](mapId int32) T {
uidData, ok := giUidMap.Load(mapId)
if !ok {
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在uid缓存", mapId)})
}
return uidData.(T)
}
// 获取设备类型获取对应字段
func getFieldNameByType(m interface{}) string {
switch m.(type) {
case *graphicData.AxleCounting:
return "AxlePointIds"
case *graphicData.Turnout:
return "TurnoutIds"
case *graphicData.Section:
return "PhysicalSectionIds"
case *graphicData.Signal:
return "SignalIds"
case *graphicData.Transponder:
return "TransponderIds"
case *graphicData.Slope:
return "SlopeIds"
case *graphicData.Curvature:
return "CurvatureIds"
case *graphicData.RelayCabinet:
return "RelayCabinetIds"
case *graphicData.Relay:
return "RelayIds"
case *graphicData.DeviceRelateRelay:
return "RelayRefIds"
default:
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"})
}
}
// 根据地图ID跟设备类型获取UID集合
func QueryMapUidMapByType(mapId int32, m interface{}) map[string]*elementIdStructure {
uidData, ok := giUidMap.Load(mapId)
if !ok {
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在uid缓存", mapId)})
}
// 字段名称
fieldName := getFieldNameByType(m)
reflectUidMap := reflect.ValueOf(&uidData).Elem()
um := reflectUidMap.Elem().FieldByName(fieldName).Interface()
uidMap, ok := um.(map[string]*elementIdStructure)
if !ok {
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: "类型不匹配"})
}
return uidMap
}
// 根据地图的comId获取UID
func QueryUidByMidAndComId(mapId int32, comId string, m interface{}) string {
uidMap := QueryMapUidMapByType(mapId, m)
if uidMap[comId] != nil {
return uidMap[comId].Uid
}
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【comId:%s】缓存", mapId, comId)})
}
// 根据地图UID获取Index
func QueryIndexByMidAndUid(mapId int32, uid string, m interface{}) int32 {
uidMap := QueryMapUidMapByType(mapId, m)
for _, u := range uidMap {
if u.Uid == uid {
return u.Index
}
}
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【uid:%s】缓存", mapId, uid)})
}

View File

@ -1,36 +1,32 @@
package memory
import (
"fmt"
"strconv"
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
"joylink.club/bj-rtsts-server/dto"
)
// 道岔相关道岔操作方法
func ChangeTurnoutState(simulation *VerifySimulation, status *state.SwitchState, mapId int32) {
index, err := strconv.Atoi(status.Id)
if err != nil {
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "参数转换出错"})
}
uid := GetDeviceUidByIndex(mapId, int32(index), &graphicData.Turnout{})
fmt.Printf("修改道岔【UID:%s】\n", uid)
/*
allSwitchMap := &simulation.Memory.Status.SwitchStateMap
d, ok := allSwitchMap.Load(status.Id)
if !ok {
panic(fmt.Sprintf("道岔【%s】不存在", status.Id))
}
cur := d.(*state.SwitchState)
if !proto.Equal(cur, status) { // 如果信息发送了变化
// 将信息合并到当前设备状态中
cur.Normal = status.Normal
cur.Reverse = status.Reverse
// 将变更信息放入变更状态队列中
simulation.Memory.ChangeStatus.SwitchStateMap.Store(status.Id, proto.Clone(cur))
index, err := strconv.Atoi(status.Id)
if err != nil {
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "参数转换出错"})
}
uid := GetDeviceUidByIndex(mapId, int32(index), &graphicData.Turnout{})
fmt.Printf("修改道岔【UID:%s】\n", uid)
allSwitchMap := &simulation.Memory.Status.SwitchStateMap
d, ok := allSwitchMap.Load(status.Id)
if !ok {
panic(fmt.Sprintf("道岔【%s】不存在", status.Id))
}
cur := d.(*state.SwitchState)
if !proto.Equal(cur, status) { // 如果信息发送了变化
// 将信息合并到当前设备状态中
cur.Normal = status.Normal
cur.Reverse = status.Reverse
// 将变更信息放入变更状态队列中
simulation.Memory.ChangeStatus.SwitchStateMap.Store(status.Id, proto.Clone(cur))
}
*/
}

View File

@ -152,7 +152,7 @@ func buildProtoRepository(storages []*graphicData.RtssGraphicStorage, mapIds []i
func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) {
axleCountingMap := make(map[string]*graphicData.AxleCounting)
uidsMap := getMapElementIdMap(mapId)
uidsMap := queryUidStructure[*stationUidStructure](mapId)
for _, data := range storage.AxleCountings {
axleCountingMap[data.Common.Id] = data
cpType := proto.CheckPointType_AxleCounter
@ -268,7 +268,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
}
}
func converCheckPointUid(data *proto.CheckPoint, uidsMap *GraphicMapElementIdStructure) *proto.CheckPoint {
func converCheckPointUid(data *proto.CheckPoint, uidsMap *stationUidStructure) *proto.CheckPoint {
data.Id = uidsMap.AxlePointIds[data.Id].Uid
for _, c := range data.DevicePorts {
c.DeviceId = converRefUid(c.DeviceId, c.DeviceType, uidsMap)
@ -276,7 +276,7 @@ func converCheckPointUid(data *proto.CheckPoint, uidsMap *GraphicMapElementIdStr
return data
}
func converSectionUid(data *proto.PhysicalSection, uidsMap *GraphicMapElementIdStructure) *proto.PhysicalSection {
func converSectionUid(data *proto.PhysicalSection, uidsMap *stationUidStructure) *proto.PhysicalSection {
data.Id = uidsMap.PhysicalSectionIds[data.Id].Uid
if data.ADevicePort != nil {
data.ADevicePort.DeviceId = converRefUid(data.ADevicePort.DeviceId, data.ADevicePort.DeviceType, uidsMap)
@ -292,7 +292,7 @@ func converSectionUid(data *proto.PhysicalSection, uidsMap *GraphicMapElementIdS
return data
}
func converTurnoutUid(data *proto.Turnout, uidsMap *GraphicMapElementIdStructure) *proto.Turnout {
func converTurnoutUid(data *proto.Turnout, uidsMap *stationUidStructure) *proto.Turnout {
data.Id = uidsMap.TurnoutIds[data.Id].Uid
if data.ADevicePort != nil {
data.ADevicePort.DeviceId = converRefUid(data.ADevicePort.DeviceId, data.ADevicePort.DeviceType, uidsMap)
@ -306,7 +306,7 @@ func converTurnoutUid(data *proto.Turnout, uidsMap *GraphicMapElementIdStructure
return data
}
func converSignalUid(data *proto.Signal, uidsMap *GraphicMapElementIdStructure) *proto.Signal {
func converSignalUid(data *proto.Signal, uidsMap *stationUidStructure) *proto.Signal {
data.Id = uidsMap.SignalIds[data.Id].Uid
if data.SectionId != "" {
data.SectionId = converRefUid(data.SectionId, proto.DeviceType_DeviceType_PhysicalSection, uidsMap)
@ -317,7 +317,7 @@ func converSignalUid(data *proto.Signal, uidsMap *GraphicMapElementIdStructure)
return data
}
func converTransponderUid(data *proto.Transponder, uidsMap *GraphicMapElementIdStructure) *proto.Transponder {
func converTransponderUid(data *proto.Transponder, uidsMap *stationUidStructure) *proto.Transponder {
data.Id = uidsMap.TransponderIds[data.Id].Uid
if data.SectionId != "" {
data.SectionId = converRefUid(data.SectionId, proto.DeviceType_DeviceType_PhysicalSection, uidsMap)
@ -328,18 +328,18 @@ func converTransponderUid(data *proto.Transponder, uidsMap *GraphicMapElementIdS
return data
}
func converSlopeUid(data *proto.Slope, uidsMap *GraphicMapElementIdStructure) *proto.Slope {
func converSlopeUid(data *proto.Slope, uidsMap *stationUidStructure) *proto.Slope {
data.Id = uidsMap.SlopeIds[data.Id].Uid
return data
}
func converCurvatureUid(data *proto.SectionalCurvature, uidsMap *GraphicMapElementIdStructure) *proto.SectionalCurvature {
func converCurvatureUid(data *proto.SectionalCurvature, uidsMap *stationUidStructure) *proto.SectionalCurvature {
data.Id = uidsMap.CurvatureIds[data.Id].Uid
return data
}
func converRefUid(id string, d proto.DeviceType, uidsMap *GraphicMapElementIdStructure) string {
var elementId *ElementIdStructure
func converRefUid(id string, d proto.DeviceType, uidsMap *stationUidStructure) string {
var elementId *elementIdStructure
switch d {
case proto.DeviceType_DeviceType_CheckPoint:
elementId = uidsMap.AxlePointIds[id]