【注释构建坡度逻辑增加link判断】
This commit is contained in:
parent
66702c7bd1
commit
7c8f7b5b94
@ -98,6 +98,7 @@ func PublishMapVerifyStructure(graphic *model.PublishedGi) *VerifyStructure {
|
||||
LogicSectionMap: make(map[string]*graphicData.LogicSection),
|
||||
SignalMap: make(map[string]*graphicData.Signal),
|
||||
CalcLinkMap: make(map[int32]*graphicData.CalculateLink),
|
||||
DevicePositionMap: make(map[string]*ref.DevicePosition),
|
||||
}
|
||||
graphicStorage := &graphicData.RtssGraphicStorage{}
|
||||
proto.Unmarshal(graphic.Proto, graphicStorage)
|
||||
@ -207,10 +208,10 @@ func turnoutMapToLink(vm *VerifyStructure, id string, port string, offset int64,
|
||||
Outter:
|
||||
for i, lm := range vm.LinkModelMap {
|
||||
linkId = i
|
||||
if lm.ARelatedSwitchRef.SwitchDevice.GetIndex() == turnoutModel.Index && lm.ARelatedSwitchRef.Port.Name() == port {
|
||||
if lm.ARelatedSwitchRef.SwitchDevice != nil && lm.ARelatedSwitchRef.SwitchDevice.GetIndex() == turnoutModel.Index && lm.ARelatedSwitchRef.Port.Name() == port {
|
||||
isStart = true
|
||||
link = lm
|
||||
} else if lm.BRelatedSwitchRef.SwitchDevice.GetIndex() == turnoutModel.Index && lm.BRelatedSwitchRef.Port.Name() == port {
|
||||
} else if lm.BRelatedSwitchRef.SwitchDevice != nil && lm.BRelatedSwitchRef.SwitchDevice.GetIndex() == turnoutModel.Index && lm.BRelatedSwitchRef.Port.Name() == port {
|
||||
link = lm
|
||||
}
|
||||
if link != nil {
|
||||
@ -295,9 +296,9 @@ func QueryDeviceByCalcLink(vm *VerifyStructure, id int32, offset int64, up, defa
|
||||
if tm == nil {
|
||||
panic(dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("不存在道岔【index:%s】", sid)})
|
||||
}
|
||||
if linkModel.ARelatedSwitchRef.SwitchDevice.GetIndex() == sid { // 起始点
|
||||
if linkModel.ARelatedSwitchRef.SwitchDevice != nil && linkModel.ARelatedSwitchRef.SwitchDevice.GetIndex() == sid { // 起始点
|
||||
return sid, linkModel.ARelatedSwitchRef.Port.Name(), offset - op, runDirection, up == false
|
||||
} else if linkModel.BRelatedSwitchRef.SwitchDevice.GetIndex() == sid { // 结束点
|
||||
} else if linkModel.BRelatedSwitchRef.SwitchDevice != nil && linkModel.BRelatedSwitchRef.SwitchDevice.GetIndex() == sid { // 结束点
|
||||
return sid, linkModel.BRelatedSwitchRef.Port.Name(), op - offset, runDirection, up == true
|
||||
} else {
|
||||
panic(dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("不存在道岔【index:%s】", devicePosition.index)})
|
||||
@ -364,11 +365,11 @@ func initGraphicStructure(graphicData *graphicData.RtssGraphicStorage, verifyStr
|
||||
// 初始化Link信息
|
||||
initLinks(graphicData.CalculateLink, verifyStructure, graphicDataMap)
|
||||
// 初始化坡度和曲线端点
|
||||
initPoints(graphicData, verifyStructure, graphicDataMap)
|
||||
// initPoints(graphicData, verifyStructure, graphicDataMap)
|
||||
// 初始化坡度
|
||||
initSlopes(graphicData.Slopes, verifyStructure, graphicDataMap)
|
||||
// initSlopes(graphicData.Slopes, verifyStructure, graphicDataMap)
|
||||
// 初始化曲线
|
||||
initCurves(graphicData.Curvatures, verifyStructure, graphicDataMap)
|
||||
// initCurves(graphicData.Curvatures, verifyStructure, graphicDataMap)
|
||||
}
|
||||
|
||||
func initCurves(curves []*graphicData.Curvature, vs *VerifyStructure, dataMap *GraphicInfoMapStructure) {
|
||||
@ -451,14 +452,18 @@ func initLinks(links []*graphicData.CalculateLink, vs *VerifyStructure, dataMap
|
||||
Index: strconv.Itoa(int(link.Index)),
|
||||
},
|
||||
Length: link.Length,
|
||||
ARelatedSwitchRef: ref.SwitchRef{
|
||||
}
|
||||
if link.ARelatedRef != nil {
|
||||
linkModel.ARelatedSwitchRef = ref.SwitchRef{
|
||||
SwitchDevice: deviceIdMap[link.ARelatedRef.Id],
|
||||
Port: face.GetPortEnum(int8(link.ARelatedRef.DevicePort)),
|
||||
},
|
||||
BRelatedSwitchRef: ref.SwitchRef{
|
||||
}
|
||||
}
|
||||
if link.BRelatedRef != nil {
|
||||
linkModel.BRelatedSwitchRef = ref.SwitchRef{
|
||||
SwitchDevice: deviceIdMap[link.BRelatedRef.Id],
|
||||
Port: face.GetPortEnum(int8(link.BRelatedRef.DevicePort)),
|
||||
},
|
||||
}
|
||||
}
|
||||
vs.LinkModelMap[link.Index] = linkModel
|
||||
dataMap.CalcLinkMap[link.Index] = link
|
||||
|
Loading…
Reference in New Issue
Block a user