物理区段增加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 return l.link
} }
//// DeviceLinkPosition device在link上的位置 type LinkRange struct {
//type DeviceLinkPosition struct { link *Link
// device Identity start int64
// position LinkPosition end int64
//} }
//
//// SlopeLinkSegment Slope在Link上的区间 func (l *LinkRange) Link() *Link {
//type SlopeLinkSegment struct { return l.link
// slope *Slope }
// start *LinkPosition
// end *LinkPosition func (l *LinkRange) Start() int64 {
//} return l.start
// }
//func (s *SlopeLinkSegment) Slope() *Slope {
// return s.slope func (l *LinkRange) End() int64 {
//} return l.end
// }
//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
//}

View File

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