jl-ecs/examples/rtss-cg/mwayside/switch_model.go
2023-08-11 10:19:34 +08:00

31 lines
678 B
Go

package mwayside
import "joylink.club/ecs/examples/rtss-cg/iwayside"
type SwitchModel struct {
//道岔基本信息
DeviceModel
//道岔A端连接的轨道
PortA *LinkRef
//道岔B端连接的轨道
PortB *LinkRef
//道岔C端连接的轨道
PortC *LinkRef
//道岔公里标,单位mm
KilometerSign int64
}
// 判端轨道是否与该道岔连接
func (me *SwitchModel) IsLink(link iwayside.ILinkModel) bool {
if nil != me.PortA && link.GetId() == me.PortA.Link.GetId() {
return true
}
if nil != me.PortB && link.GetId() == me.PortB.Link.GetId() {
return true
}
if nil != me.PortC && link.GetId() == me.PortC.Link.GetId() {
return true
}
return false
}