rts-sim-module/component/train.go

42 lines
996 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package component
import (
"fmt"
"joylink.club/ecs"
)
// TrainPositionInfo 列车当前位置信息
type TrainPositionInfo struct {
//列车头当前运行方向true偏移量增大/false减小方向
//link 由a->b偏移量增大
Up bool
//列车长度 mm
Len int64
//列车所在轨道link
HeadLink string
//列车所在link偏移量mm
HeadLinkOffset int64
//列车所在轨道link
TailLink string
//列车所在link偏移量mm
TailLinkOffset int64
//车头所在物理区段
HeadSectionId string
//车头所在物理区段偏移量
HeadSectionOffset uint32
//车尾所在物理区段
TailSectionId string
//车尾所在物理区段偏移量
TailSectionOffset uint32
}
func (t *TrainPositionInfo) ToString() string {
return fmt.Sprintf("Up=%t len=%d headLink=%s headOff=%d tailLink=%s tailOff=%d", t.Up, t.Len, t.HeadLink, t.HeadLinkOffset, t.TailLink, t.TailLinkOffset)
}
var (
TrainPositionInfoType = ecs.NewComponentType[TrainPositionInfo]()
)