【link映射公里标】
This commit is contained in:
parent
deda54551d
commit
0f3422de0f
@ -140,6 +140,7 @@ func turnoutMapToEcsLink(repo *repository.Repository, id string, port string, of
|
|||||||
}
|
}
|
||||||
// 岔心公里标
|
// 岔心公里标
|
||||||
crossKm = turnout.GetTurnoutKm(proto2.Port_None)
|
crossKm = turnout.GetTurnoutKm(proto2.Port_None)
|
||||||
|
portKm = repo.ConvertKilometer(portKm, crossKm.CoordinateSystem)
|
||||||
// 关联link
|
// 关联link
|
||||||
link := portPosition.Link()
|
link := portPosition.Link()
|
||||||
isStart := link.ARelation().Device().Id() == id
|
isStart := link.ARelation().Device().Id() == id
|
||||||
@ -173,7 +174,7 @@ func QueryDeviceByCalcLink(repo *repository.Repository, id string, offset int64,
|
|||||||
// 判断是否在道岔上
|
// 判断是否在道岔上
|
||||||
onTurnout, isA := isOnLinkTurnout(link, offset)
|
onTurnout, isA := isOnLinkTurnout(link, offset)
|
||||||
if onTurnout {
|
if onTurnout {
|
||||||
return ecsLinkMapToTurnout(isA, offset, up, link)
|
return ecsLinkMapToTurnout(repo, isA, offset, up, link)
|
||||||
} else {
|
} else {
|
||||||
return ecsLinkMapToSection(offset, up, link)
|
return ecsLinkMapToSection(offset, up, link)
|
||||||
}
|
}
|
||||||
@ -198,7 +199,7 @@ func isOnLinkTurnout(link *repository.Link, offset int64) (bool, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理在道岔上link映射
|
// 处理在道岔上link映射
|
||||||
func ecsLinkMapToTurnout(isA bool, offset int64, up bool, link *repository.Link) (
|
func ecsLinkMapToTurnout(repo *repository.Repository, isA bool, offset int64, up bool, link *repository.Link) (
|
||||||
deviceId, port string, deviceOffset int64, runDirection, pointTo bool, km int64) {
|
deviceId, port string, deviceOffset int64, runDirection, pointTo bool, km int64) {
|
||||||
tp := link.ARelation()
|
tp := link.ARelation()
|
||||||
if !isA {
|
if !isA {
|
||||||
@ -206,7 +207,9 @@ func ecsLinkMapToTurnout(isA bool, offset int64, up bool, link *repository.Link)
|
|||||||
}
|
}
|
||||||
deviceId = tp.Turnout().Id()
|
deviceId = tp.Turnout().Id()
|
||||||
tpOffset := tp.Turnout().FindLinkPositionByPort(tp.Port()).Offset()
|
tpOffset := tp.Turnout().FindLinkPositionByPort(tp.Port()).Offset()
|
||||||
crossKm, portKm := tp.Turnout().GetTurnoutKm(proto2.Port_None).Value, tp.Turnout().GetTurnoutKm(tp.Port()).Value
|
crossKmInfo, portKmInfo := tp.Turnout().GetTurnoutKm(proto2.Port_None), tp.Turnout().GetTurnoutKm(tp.Port())
|
||||||
|
portKmInfo = repo.ConvertKilometer(portKmInfo, crossKmInfo.CoordinateSystem)
|
||||||
|
crossKm, portKm := crossKmInfo.Value, portKmInfo.Value
|
||||||
if isA {
|
if isA {
|
||||||
deviceOffset = tpOffset - (tpOffset - offset)
|
deviceOffset = tpOffset - (tpOffset - offset)
|
||||||
pointTo = !up
|
pointTo = !up
|
||||||
@ -217,10 +220,13 @@ func ecsLinkMapToTurnout(isA bool, offset int64, up bool, link *repository.Link)
|
|||||||
// 查询公里标大于端口公里标
|
// 查询公里标大于端口公里标
|
||||||
if crossKm > portKm {
|
if crossKm > portKm {
|
||||||
km = crossKm - deviceOffset
|
km = crossKm - deviceOffset
|
||||||
runDirection = pointTo
|
|
||||||
} else {
|
} else {
|
||||||
km = crossKm + deviceOffset
|
km = crossKm + deviceOffset
|
||||||
runDirection = !pointTo
|
}
|
||||||
|
if up {
|
||||||
|
runDirection = (crossKm > portKm) == !isA
|
||||||
|
} else {
|
||||||
|
runDirection = (crossKm < portKm) == !isA
|
||||||
}
|
}
|
||||||
switch tp.Port() {
|
switch tp.Port() {
|
||||||
case proto2.Port_A:
|
case proto2.Port_A:
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit d36ba6fc7dfe5235ace72be522566e55aadd34e1
|
Subproject commit b8db4336fb78c17fe179b7927929808a5793f0dc
|
Loading…
Reference in New Issue
Block a user