From 148254bb1dc170db320bcb208ca79b0e252751d8 Mon Sep 17 00:00:00 2001
From: fctom1215 <fctom1215@outlook.com>
Date: 星期三, 28 四月 2021 19:26:00 +0800
Subject: [PATCH] 修改科目三道路识别问题

---
 lib/src/main/cpp/test_items2/road_exam.cpp |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/lib/src/main/cpp/test_items2/road_exam.cpp b/lib/src/main/cpp/test_items2/road_exam.cpp
index c946ecc..003f787 100644
--- a/lib/src/main/cpp/test_items2/road_exam.cpp
+++ b/lib/src/main/cpp/test_items2/road_exam.cpp
@@ -412,24 +412,31 @@
         vector<PointF> roadOutLine;
         Polygon area;
 
+//        DEBUG("CalcRoadIndex %d 鍋氱偣 %d 鏈夌偣 %d", index, RoadMap.roads[index].leftEdge.size(), RoadMap.roads[index].rightEdge.size());
+
         for (int i = 0; i < RoadMap.roads[index].leftEdge.size(); ++i) {
             for (int j = 0; j < RoadMap.roads[index].leftEdge[i].points.size(); ++j) {
                 if (changeSegment && roadOutLine.size() > 0 && IsSamePoint(roadOutLine.back(), RoadMap.roads[index].leftEdge[i].points[j])) {
+//                    DEBUG("閲嶅鐐�");
                     continue;
                 }
                 changeSegment = false;
                 roadOutLine.push_back(RoadMap.roads[index].leftEdge[i].points[j]);
+//                DEBUG("鍋氱偣鍔犲叆 point (%f, %f)", RoadMap.roads[index].leftEdge[i].points[j].X, RoadMap.roads[index].leftEdge[i].points[j].Y);
             }
             changeSegment = true;
         }
 
         for (int i = 0; i < RoadMap.roads[index].rightEdge.size(); ++i) {
             for (int j = RoadMap.roads[index].rightEdge[i].points.size() - 1; j >= 0; --j) {
-                if (changeSegment && roadOutLine.size() > 0 && IsSamePoint(roadOutLine.back(), RoadMap.roads[index].leftEdge[i].points[j])) {
+                if (changeSegment && roadOutLine.size() > 0 && IsSamePoint(roadOutLine.back(), RoadMap.roads[index].rightEdge[i].points[j])) {
+//                    DEBUG("閲嶅鐐�");
                     continue;
                 }
                 changeSegment = false;
                 roadOutLine.push_back(RoadMap.roads[index].rightEdge[i].points[j]);
+
+//                DEBUG("鏈夌偣鍔犲叆 point (%f, %f)", RoadMap.roads[index].rightEdge[i].points[j].X, RoadMap.roads[index].rightEdge[i].points[j].Y);
             }
             changeSegment = true;
         }
@@ -440,6 +447,12 @@
         for (int i = 0; i < area.num; ++i) {
             area.point[i] = roadOutLine[i];
         }
+
+//         {
+//            for (int x = 0; x < area.num; ++x) {
+//                DEBUG("road %d point %d (%f, %f)", index, x, area.point[x].X, area.point[x].Y);
+//            }
+//        }
 
         if (IntersectionOf(car->carXY[car->axial[AXIAL_FRONT]], &area) == GM_Containment) {
             free(area.point);
@@ -1401,8 +1414,8 @@
 
         // 鎸′綅涓嶅尮閰嶈秴鏃�
         if (currGearError && prevGearError) {
-            DEBUG("鎸′綅閿欒澧炲姞 %ld姣 褰撳墠鎸′綅 %d 鏃堕�� %f", TimeGetDiff(rtkTime, &gearErrorTimePoint),
-                  ReadCarStatus(GEAR), ConvertMs2KMh(speed));
+//            DEBUG("鎸′綅閿欒澧炲姞 %ld姣 褰撳墠鎸′綅 %d 鏃堕�� %f", TimeGetDiff(rtkTime, &gearErrorTimePoint),
+//                  ReadCarStatus(GEAR), ConvertMs2KMh(speed));
             gearErrorTime += TimeGetDiff(rtkTime, &gearErrorTimePoint);
         }
         if (gearErrorTime > examParam.gear_speed_error_cumulative_time) {
@@ -1562,6 +1575,7 @@
             DEBUG("瀵煎悜绫诲瀷鍒囨崲 %d", Lane.guide);
         }
     }
+    DEBUG("currExamMapIndex = %d Lane.no = %d Lane.guide = %d (%f, %f)", currExamMapIndex, Lane.no, Lane.guide, car->carXY[car->axial[AXIAL_FRONT]].X, car->carXY[car->axial[AXIAL_FRONT]].Y);
 
     if (currExamMapIndex >= 0 && Lane.guide == 0) {
         BigStraightRoadFree = AnalysisRoad(RoadMap, currExamMapIndex, Lane, car);
@@ -1714,7 +1728,10 @@
         item = EntryItem(roadIndex, RoadMap, car, CarModelList, forward, moveDirect);
     }
 
-    if (RoadExamStatus == ROAD_EXAM_READY_NEXT && item == 3) {
+    if (RoadExamStatus == RoadExamStatus && item == 6) {
+        PlayTTS("鍓嶆柟浼氳溅", NULL);
+    }
+    else if (RoadExamStatus == ROAD_EXAM_READY_NEXT && item == 3) {
         StartDriveStraightExam();
         RoadExamStatus = ROAD_EXAM_ITEM_STRAIGHT;
     } else if (RoadExamStatus == ROAD_EXAM_READY_NEXT && item == 4) {

--
Gitblit v1.8.0