This commit is contained in:
xzb 2023-10-16 14:06:47 +08:00
parent b698316777
commit 2dc698ccfc

View File

@ -239,20 +239,24 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
if signal == nil { if signal == nil {
continue continue
} }
for _, group := range relationship.Combinationtypes { //信号机只有一个组合类型
var componentIds []string if len(relationship.Combinationtypes) != 1 {
for _, relayId := range group.RefRelays { panic(fmt.Sprintf("信号机[%s]须有一个组合类型", signal.Id))
if uidsMap.RelayIds[relayId] == nil {
continue
}
componentIds = append(componentIds, uidsMap.RelayIds[relayId].Uid)
}
signal.ElectronicComponentGroups = append(signal.ElectronicComponentGroups,
&proto.ElectronicComponentGroup{
Code: group.Code,
ComponentIds: componentIds,
})
} }
group := relationship.Combinationtypes[0]
var componentIds []string
for _, relayId := range group.RefRelays {
if uidsMap.RelayIds[relayId] == nil {
continue
}
componentIds = append(componentIds, uidsMap.RelayIds[relayId].Uid)
}
signal.Code = group.Code
signal.ElectronicComponentGroups = append(signal.ElectronicComponentGroups,
&proto.ElectronicComponentGroup{
Code: group.Code,
ComponentIds: componentIds,
})
} }
} }
} }
@ -351,6 +355,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
Km: convertKm(data.KilometerSystem), Km: convertKm(data.KilometerSystem),
SectionId: sectionId, SectionId: sectionId,
TurnoutPort: turnoutPort, TurnoutPort: turnoutPort,
//Code: data.,
} }
repo.Signals = append(repo.Signals, converSignalUid(signal, uidsMap)) repo.Signals = append(repo.Signals, converSignalUid(signal, uidsMap))
} }