【解决坡度、曲度构建问题】

This commit is contained in:
weizhihong 2023-08-18 18:07:39 +08:00
parent 5cc59f3ce3
commit b5ea137a18

View File

@ -365,50 +365,60 @@ 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) {
for _, curve := range curves {
startDp := dataMap.DevicePositionMap[curve.RefDeviceId[0]]
endDp := dataMap.DevicePositionMap[curve.RefDeviceId[1]]
startIndex, _ := strconv.Atoi(startDp.Device.GetIndex())
endIndex, _ := strconv.Atoi(endDp.Device.GetIndex())
vs.CurveModelMap[curve.Common.Id] = &section.CurveModel{
c := &section.CurveModel{
DeviceModel: face.DeviceModel{
GraphicId: curve.GetCommon().GetId(),
Index: curve.GetCommon().GetId(),
},
StartLinkIndex: int32(startIndex),
StartLinkOffset: startDp.Offset,
EndLinkIndex: int32(endIndex),
EndLinkOffset: endDp.Offset,
Curvature: curve.CurvatureNumber,
Curvature: curve.CurvatureNumber,
}
startDp := dataMap.DevicePositionMap[curve.RefDeviceId[0]]
if startDp != nil {
startIndex, _ := strconv.Atoi(startDp.Device.GetIndex())
c.StartLinkIndex = int32(startIndex)
c.StartLinkOffset = startDp.Offset
}
endDp := dataMap.DevicePositionMap[curve.RefDeviceId[1]]
if endDp != nil {
endIndex, _ := strconv.Atoi(endDp.Device.GetIndex())
c.EndLinkIndex = int32(endIndex)
c.EndLinkOffset = endDp.Offset
}
vs.CurveModelMap[curve.Common.Id] = c
}
}
func initSlopes(slopes []*graphicData.Slope, vs *VerifyStructure, dataMap *GraphicInfoMapStructure) {
for _, slope := range slopes {
startDp := dataMap.DevicePositionMap[slope.RefDeviceId[0]]
endDp := dataMap.DevicePositionMap[slope.RefDeviceId[1]]
startIndex, _ := strconv.Atoi(startDp.Device.GetIndex())
endIndex, _ := strconv.Atoi(endDp.Device.GetIndex())
vs.SlopeModelMap[slope.Common.Id] = &section.SlopeModel{
s := &section.SlopeModel{
DeviceModel: face.DeviceModel{
GraphicId: slope.GetCommon().GetId(),
Index: slope.GetCommon().GetId(),
},
StartLinkIndex: int32(startIndex),
StartLinkOffset: startDp.Offset,
EndLinkIndex: int32(endIndex),
EndLinkOffset: endDp.Offset,
DegreeTrig: slope.SlopeNumber,
DegreeTrig: slope.SlopeNumber,
}
startDp := dataMap.DevicePositionMap[slope.RefDeviceId[0]]
if startDp != nil {
startIndex, _ := strconv.Atoi(startDp.Device.GetIndex())
s.StartLinkIndex = int32(startIndex)
s.StartLinkOffset = startDp.Offset
}
endDp := dataMap.DevicePositionMap[slope.RefDeviceId[1]]
if endDp != nil {
endIndex, _ := strconv.Atoi(endDp.Device.GetIndex())
s.EndLinkIndex = int32(endIndex)
s.EndLinkOffset = endDp.Offset
}
vs.SlopeModelMap[slope.Common.Id] = s
}
}
@ -478,6 +488,9 @@ func initLinks(links []*graphicData.CalculateLink, vs *VerifyStructure, dataMap
Device: modeller,
Offset: dp.Offset,
})
if dp.DeviceId == "1352" {
fmt.Println("11")
}
dataMap.DevicePositionMap[dp.DeviceId] = &ref.DevicePosition{
Device: linkModel,
Offset: dp.Offset,