物理区段增加LinkRange

This commit is contained in:
joylink_zhangsai 2023-11-10 11:05:07 +08:00
parent 3f9adca4b0
commit 5667b3fcd1
2 changed files with 19 additions and 93 deletions

View File

@ -141,88 +141,20 @@ func (l *LinkPort) Device() PortedDevice {
return l.link
}
//// DeviceLinkPosition device在link上的位置
//type DeviceLinkPosition struct {
// device Identity
// position LinkPosition
//}
//
//// SlopeLinkSegment Slope在Link上的区间
//type SlopeLinkSegment struct {
// slope *Slope
// start *LinkPosition
// end *LinkPosition
//}
//
//func (s *SlopeLinkSegment) Slope() *Slope {
// return s.slope
//}
//
//func (s *SlopeLinkSegment) Start() *LinkPosition {
// return s.start
//}
//
//func (s *SlopeLinkSegment) End() *LinkPosition {
// return s.end
//}
//
//type SectionalCurvatureLinkSegment struct {
// sectionalCurvature *SectionalCurvature
// start *LinkPosition
// end *LinkPosition
//}
//
//// LinkNode link节点
//type LinkNode struct {
// Identity
// turnout *Turnout
// aRelation LinkPort
// bRelation LinkPort
// cRelation LinkPort
//}
//
//func (ln LinkNode) ButtonCode() string {
// return ln.turnout.ButtonCode()
//}
//
//func (ln LinkNode) PortNum() int {
// return 3
//}
//
//func (ln LinkNode) bindDevicePort(port proto.Port, devicePort DevicePort) error {
// linkPort, isLinkPort := devicePort.(*LinkPort)
// if !isLinkPort {
// return errors.New(fmt.Sprintf("Link节点不能与[%s]类型的设备关联", devicePort.Device().Type()))
// }
// switch port {
// case proto.Port_A:
// ln.aRelation = *linkPort
// case proto.Port_B:
// ln.bRelation = *linkPort
// case proto.Port_C:
// ln.cRelation = *linkPort
// default:
// return errors.New(fmt.Sprintf("Link节点没有端口[%s]", port))
// }
// return nil
//}
//
//type LinkNodePort struct {
// node *LinkNode
// port proto.Port
//}
//
//func NewLinkNodePort(node *LinkNode, port proto.Port) *LinkNodePort {
// return &LinkNodePort{
// node: node,
// port: port,
// }
//}
//
//func (lp *LinkNodePort) Port() proto.Port {
// return lp.port
//}
//
//func (lp *LinkNodePort) Device() PortedDevice {
// return lp.node
//}
type LinkRange struct {
link *Link
start int64
end int64
}
func (l *LinkRange) Link() *Link {
return l.link
}
func (l *LinkRange) Start() int64 {
return l.start
}
func (l *LinkRange) End() int64 {
return l.end
}

View File

@ -33,6 +33,8 @@ type PhysicalSection struct {
//在Link上的区间根据aKm和bKm计算出的start的offset一定小于end的offset
startLinkPosition *LinkPosition
endLinkPosition *LinkPosition
//在Link上的区间
linkRanges []*LinkRange
//物理区段所属集中站
centralizedStation string
@ -56,14 +58,6 @@ func (s *PhysicalSection) BLinkPosition() *LinkPosition {
return s.bLinkPosition
}
func (s *PhysicalSection) StartLinkPosition() *LinkPosition {
return s.startLinkPosition
}
func (s *PhysicalSection) EndLinkPosition() *LinkPosition {
return s.endLinkPosition
}
func (s *PhysicalSection) ARelation() DevicePort {
return s.aRelation
}