[2.13.0-arhc-opt] fix bug of traffic light
This commit is contained in:
@@ -15,15 +15,17 @@ fun TrafficLightResult.toTrafficLightDetail():MessagePad.TrafficLightDetail{
|
||||
val left = trafficLightBuilder.leftBuilder
|
||||
val mid = trafficLightBuilder.midBuilder
|
||||
val right = trafficLightBuilder.rightBuilder
|
||||
left.phaseNo = this.laneList.left.phaseNo
|
||||
left.color = this.laneList.left.color
|
||||
left.remain = this.laneList.left.remain
|
||||
mid.phaseNo = this.laneList.mid.phaseNo
|
||||
mid.color = this.laneList.mid.color
|
||||
mid.remain = this.laneList.mid.remain
|
||||
right.phaseNo = this.laneList.right.phaseNo
|
||||
right.color = this.laneList.right.color
|
||||
right.remain = this.laneList.right.remain
|
||||
if(this.laneList != null){
|
||||
left.phaseNo = this.laneList.left.phaseNo
|
||||
left.color = this.laneList.left.color
|
||||
left.remain = this.laneList.left.remain
|
||||
mid.phaseNo = this.laneList.mid.phaseNo
|
||||
mid.color = this.laneList.mid.color
|
||||
mid.remain = this.laneList.mid.remain
|
||||
right.phaseNo = this.laneList.right.phaseNo
|
||||
right.color = this.laneList.right.color
|
||||
right.remain = this.laneList.right.remain
|
||||
}
|
||||
return trafficLightBuilder.build()
|
||||
}
|
||||
|
||||
@@ -39,7 +41,7 @@ data class TrafficLightResult(
|
||||
val lightId: Int, //红绿灯ID
|
||||
val laneNo: Int, //车道号
|
||||
val arrowNo: Int, //当前车道对应地面要素转向
|
||||
val laneList: TrafficLightDetail, //灯态具体信息
|
||||
val laneList: TrafficLightDetail?, //灯态具体信息
|
||||
val flashYellow: Int,// 黄灯总时间
|
||||
val timeStamp: Long //当前卫星时间,单位:ms
|
||||
) {
|
||||
|
||||
@@ -4,6 +4,9 @@ object TrafficLightStatusHelper {
|
||||
|
||||
fun getCurrentRoadTrafficLight(trafficLightResult: TrafficLightResult): TrafficLightStatus? {
|
||||
val arrowNo = trafficLightResult.arrowNo
|
||||
if(trafficLightResult.laneList == null){
|
||||
return null
|
||||
}
|
||||
if (RoadArrow.isLeft(arrowNo) && trafficLightResult.laneNo == -1) {
|
||||
return trafficLightResult.laneList.left
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user