2023-09-06 16:20:36 +08:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import "joylink.club/rtsssimulation/repository/model/proto"
|
|
|
|
|
|
|
|
type Signal struct {
|
|
|
|
Identity
|
2023-10-13 14:59:08 +08:00
|
|
|
code string
|
|
|
|
km *proto.Kilometer
|
2023-09-14 15:06:51 +08:00
|
|
|
//section *PhysicalSection
|
|
|
|
//turnoutPort TurnoutPort
|
2023-09-20 15:14:38 +08:00
|
|
|
linkPosition *LinkPosition
|
2023-10-08 13:11:34 +08:00
|
|
|
//信号机电路系统电子元器件
|
|
|
|
componentGroups []*ElectronicComponentGroup
|
2023-10-20 09:41:49 +08:00
|
|
|
model proto.Signal_Model
|
2023-09-06 16:20:36 +08:00
|
|
|
}
|
|
|
|
|
2023-10-20 09:41:49 +08:00
|
|
|
func NewSignal(id string, km *proto.Kilometer, code string, model proto.Signal_Model) *Signal {
|
2023-09-06 16:20:36 +08:00
|
|
|
return &Signal{
|
|
|
|
Identity: identity{id, proto.DeviceType_DeviceType_Signal},
|
|
|
|
km: km,
|
2023-10-13 14:59:08 +08:00
|
|
|
code: code,
|
2023-10-20 09:41:49 +08:00
|
|
|
model: model,
|
2023-09-06 16:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-20 15:14:38 +08:00
|
|
|
func (s *Signal) bindLinkPosition(position *LinkPosition) {
|
|
|
|
s.linkPosition = position
|
|
|
|
}
|
|
|
|
|
2023-10-08 13:11:34 +08:00
|
|
|
// func (s *Signal) bindSection(section *PhysicalSection) {
|
|
|
|
// s.section = section
|
|
|
|
// }
|
2023-09-14 15:06:51 +08:00
|
|
|
//
|
2023-10-08 13:11:34 +08:00
|
|
|
// func (s *Signal) bindTurnoutPort(tp TurnoutPort) {
|
|
|
|
// s.turnoutPort = tp
|
|
|
|
// }
|
|
|
|
func (s *Signal) RelayGroups() []*ElectronicComponentGroup {
|
|
|
|
return s.componentGroups
|
|
|
|
}
|
2023-10-13 14:59:08 +08:00
|
|
|
func (s *Signal) Code() string {
|
|
|
|
return s.code
|
|
|
|
}
|
2023-10-20 10:21:35 +08:00
|
|
|
func (s *Signal) Model() proto.Signal_Model {
|
|
|
|
return s.model
|
|
|
|
}
|